TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
useful things: dialup script
In case anyone cares, here's the script I currently use to dial my modem. (RedHat 6.1, using wvdial, probably not very portable).
#!/bin/sh
# goes online, checks connection speed, hangs up if speed is too low, and retries.
MINSPEED='28800'
FALSE='0'
TRUE='1'
GOOD='0'
while [ $GOOD -eq $FALSE ]; do
GOOD=$TRUE
/sbin/ifup ppp0
CURSPEED=`grep CONNECT /var/log/messages|tail -n1|awk '{print $7}'|cut -c1-5`
if ! [ $MINSPEED -le $CURSPEED ]
then /sbin/ifdown ppp0
GOOD=$FALSE
fi
done
echo connected at $CURSPEED
#make sure all queued mail is sent.
/usr/sbin/sendmail -q
this seems a bit kludgy, tho. can anyone think of a better way to do it?
I had to chmod /var/log/messages to be group-readable to make this work.
Carl Soderstrom
--
Network Engineer
Real-Time Enterprises
(952) 943-8700