Hi guys,
I am writing a script to run on one of my permanently connected dialup
boxes.. it will run every 60 minuites as a crontab..
The two things I am not sure about.. if I want to issue a hard reset to the
modem.. how can I do that from a shell script???
Also, what should I do to physically test if a connection is functioning
properly? I could try pinging a dns server somewhere and capture the result,
grep it or something, but there must be an easier way.. any ideas?
(traceroute maybe?)
I am gonna add alot more to the script, I want it to test the connection 5
times or more before it assumes its not working.
and I want the script to count how many times it issues "ifup ppp0" and not
do it more then 5 times an hour..
anyone feel like jumping in with some suggestions??? :-)
Here is what I have so far:
#!/bin/sh
# Set some variables.
IFCONFIG = `which ifconfig`
EXTERNAL = "ppp0"
# Test if ppp0 is ip:
if [ ! -z "`$IFCONFIG $EXTERNAL 2>/dev/null | grep UP`" ];
then
# Interface ppp0 is up,
# now see if it is working properly.
# try contacting a site. ping? traceroute? other?
# Yet to do that.. wondering what the best method is...
else
# ppp0 is down.
# Hard reset the modem. (how?)
# Start the ppp0 connection.
ifup ppp0
fi
Thats a long way from finished.. I want the scritp to test the connection 5
times or more.. (I mean try connecting to an external src) before it assumes
the connection isn't working properly, its a dialup machine, so if its
mailing a big file or something, it might not respond for a while.. so I
don't want to assume that one test is definative.
Kindest regards
Frank
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com