Dialup Expect script
#!/bin/sh -x
# exit if already on
ps ax | grep -v grep | grep -s "/usr/sbin/pppd"
if [ "$?" = "0" ]
then
exit
fi
# start wvdial
/usr/local/bin/wvdial &
WVDIALPROC="$!"
# wait for pppd to start
while true
do
ps ax | grep -v grep | grep -s 'pppd'
if
[ "$?" = "0" ] then
break
fi
sleep 5
done
# this sleep may reduce the number of times it seems to
kill wvdial before # ip-up has a chance to start
sleep 15
# wait for ip-up.local to finish, then kill
while [ true ]
do
ps ax |grep -v grep | grep -s '/etc/ppp/ip-up'
if [ "$?" != "0" ]
then
kill $WVDIALPROC
exit
fi
sleep 5
done
This seems to work pretty well. Your mileage may vary on how long to sleep to be sure that ip-up has had a chance to start before starting to check whether it has ended.
Last modified: 2002-06-29 11:12, 2007
www.laymusic.org/dialup.html
