From owner-freebsd-isp Sat Apr 3 13:28:17 1999 Delivered-To: freebsd-isp@freebsd.org Received: from awfulhak.org (awfulhak.force9.co.uk [195.166.136.63]) by hub.freebsd.org (Postfix) with ESMTP id 9E45D14DDE for ; Sat, 3 Apr 1999 13:27:47 -0800 (PST) (envelope-from brian@lan.awfulhak.org) Received: from keep.lan.Awfulhak.org (keep.lan.Awfulhak.org [172.16.0.8]) by awfulhak.org (8.9.2/8.9.2) with ESMTP id TAA12556; Sat, 3 Apr 1999 19:42:58 +0100 (BST) (envelope-from brian@lan.awfulhak.org) Received: from keep.lan.Awfulhak.org (localhost [127.0.0.1]) by keep.lan.Awfulhak.org (8.9.3/8.9.3) with ESMTP id TAA35106; Sat, 3 Apr 1999 19:42:09 +0100 (BST) (envelope-from brian@keep.lan.Awfulhak.org) Message-Id: <199904031842.TAA35106@keep.lan.Awfulhak.org> X-Mailer: exmh version 2.0.2 2/24/98 To: Rowan Crowe Cc: freebsd-isp@FreeBSD.ORG Subject: Re: pppd redial script In-reply-to: Your message of "Sat, 03 Apr 1999 20:45:49 +1000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 03 Apr 1999 19:42:09 +0100 From: Brian Somers Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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 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