[mu TECH] ppp-on tweak

From: Alfie Costa (agcosta@gis.net)
Date: Thu Apr 06 2000 - 06:18:43 CEST


Reading through some of /usr/bin I made some tiny (one might even say trivial)
improvements, not difficult, but good exercise. No functions added, no new
algorithms, just tweaks. I hope they're OK anyway and also hope that these
tweaks don't introduce any unforseen bugs. People interested in learning shell
scripting may be interested as well. Here's the first...

In /usr/bin/ppp-on

This code:

    while [ 1 ]
    do

    case "`ifconfig|fgrep ppp`" in
    *ppp*) done=yes;;
    *) done=;;
    esac

    [ "$done" ] && break

    echo -n "."
    sleep 1
    done

...can be this:

    until ifconfig|fgrep ppp > /dev/null
    do
        echo -n "."
        sleep 1
    done

Attached is the changed ppp-on.


#!/bin/ash
#########################
# connect to Internet via PPP
# by M. Andreoli
#########################
 
#set -x

# read -p "Turn on the modem (if any!) and press -RETURN- " dummy

echo "Starting pppd."
pppd

echo -n "Please, wait "

until ifconfig|fgrep ppp > /dev/null
do
    echo -n "."
    sleep 1
done

echo "connected"

echo
route -n | grep ppp
echo
sleep 1

queue=`/bin/ls /var/spool/mqueue`

if [ "$queue" ] ; then
    read -p "Do You want to process mail queue? (y/N)" pm
    [ "$pm" = y ] && sendmail -q
fi


---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: mulinux-help@sunsite.auc.dk



This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:13 CET