Date: Sat, 03 Apr 1999 19:42:09 +0100 From: Brian Somers <brian@Awfulhak.org> To: Rowan Crowe <rowan@sensation.net.au> Cc: freebsd-isp@FreeBSD.ORG Subject: Re: pppd redial script Message-ID: <199904031842.TAA35106@keep.lan.Awfulhak.org> In-Reply-To: Your message of "Sat, 03 Apr 1999 20:45:49 %2B1000." <Pine.BSF.4.01.9904032015420.13153-100000@velvet.sensation.net.au>
next in thread | previous in thread | raw e-mail | index | archive | help
Check out the redial command in the latest user-ppp. You can for example set redial 10+20-300 For redial pauses of 10, 30, 50, 110 .... 300, 300 It's not incremental, but it does the job. > Hi all, > > This is a redial script I wrote the other night, which redials after the > link drops out but backs off exponentially if redial attempts keep > failing. (In Australia, we pay 25c per call, so if the other end is > answering but there's some sort of PPP problem, constant redials could end > up costing $$$). Redial delay is capped at 300 seconds maximum. > > Basically the delays for repeated failed attempts will go something like: > 5, 15, 45, 135, 300, 300, 300... > > Once the link has been up more than 10 minutes, it is considered "stable" > and the redial delay is reset to 5 seconds when it next drops. > > I'd be interested in any comments. Feel free to use it yourselves. To run > it in the background use '&' on the commandline. (the info messages could > probably be >>'d to a log file). > > > #!/bin/sh > delay1=5 > while : > do > stime=`date "+%s"` > # use your own pppd options here, but make sure you have -detach > /usr/sbin/pppd -detach connect '/usr/bin/chat -v -f /etc/ppp/ppp-sens.scr' /dev/cuaa0 115200 deflate 15 bsdcomp 15 203.20.114.194: lcp-echo-interval 30 lcp-echo-failure 2 > etime=`date "+%s"` > connectedtime=`expr ${etime} - ${stime}` > echo "time connected=${connectedtime} seconds" > if [ "`expr ${connectedtime} \< 600`" = "1" ]; then > delay1=`expr ${delay1} \* 3` > echo "delay now ${delay1} seconds" > if [ "`expr ${delay1} \> 300`" = "1" ]; then > echo "capping delay at 300 seconds" > delay1=300 > fi > fi > if [ "`expr ${connectedtime} \> 600`" = "1" ]; then > echo "resetting delay to 5 seconds" > delay1=5 > fi > echo "sleeping ${delay1} seconds" > sleep ${delay1} > done > > > > -- > Rowan Crowe Sensation Internet Services, Melbourne Aust > fidonet: 3:635/728 +61-3-9388-9260 > http://www.rowan.sensation.net.au/ http://www.sensation.net.au/ -- Brian <brian@Awfulhak.org> <brian@FreeBSD.org> <brian@OpenBSD.org> <http://www.Awfulhak.org> Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199904031842.TAA35106>