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

Re: script to stay connected



Once upon a time s. keeling said...
> Incoming from David Baron:
> > Is there a little script that can be cron-d to check if the internet 
> > connection (pptp -> ppp0) is up and if not, reconnect?
> 
> Try using the keyword "persist" in /etc/ppp/options.

For some reason, that does not work for me. It used to, then one day
over a year ago, I was getting dropped connections and no reconnection.

So I have the script below that I use, run from cron every five minutes.
I still have persist in my ppp options, so if it feels like it, it can
automatically restart my connection immediately, but if it doesn't, it
wont be down for more than five minutes.

-------------------------
#!/bin/sh

if ! /bin/ip addr show ppp1 ; then
  /sbin/ifdown ppp1 2>&1
  sleep 2
  /sbin/ifup ppp1 2>&1
fi
-------------------------




Reply to: