[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Keeping Machine Up - Advice Needed



*-timothy@smasher.rs.itd.umich.edu (19 Jul)
|
|         One thing that happens occasionally is that my ISP has problems and
| their gateway will stop working and packets don't get out, but it doensn't
| actually disconnect. So I was thinking I should put something in my cron.daily
| to restart the ppp connection - What should I use to restart pppd or kill it
| and start a new one?
|         

You could write a shell script that fpings a far away site.  If it
fails then it could send pppd a HUP signal which will shutdown and
restart the connection if you have the persist option set.  You could
stick the script in the crontab and run it every so often or put a
it in while loop and run it from ip-up. (check the code first I am a
shell code hacker not an expert)

#!/bin/sh
# crontab script
fping -q far.away.host
if ( "$?" == "1" ); then
  kill -HUP `cat /var/run/ppp0.pid`;
fi
# end of code


#!/bin/sh
# ip-up script
run=1
while ( "$run" == "1" ); do
  fping -q far.away.host
  if ( "$?" == "1" ); then
    run=0 # not really necessary since pppd will be reset
    kill -HUP `cat /var/run/ppp0.pid`;
  fi 
  sleep 600;
done
# end of code

Brian 
-- 
Mechanical Engineering                              servis@purdue.edu
Purdue University                   http://www.ecn.purdue.edu/~servis


--  
Unsubscribe?  mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null


Reply to: