From owner-freebsd-hackers Fri Oct 4 12:03:14 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id MAA07576 for hackers-outgoing; Fri, 4 Oct 1996 12:03:14 -0700 (PDT) Received: from starfire.mn.org (root@starfire.skypoint.net [199.86.32.187]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id MAA07571 for ; Fri, 4 Oct 1996 12:03:10 -0700 (PDT) From: john@starfire.mn.org Received: (from john@localhost) by starfire.mn.org (8.6.12/1.1) id OAA18711 for hackers@FreeBSD.org; Fri, 4 Oct 1996 14:03:07 -0500 Message-Id: <199610041903.OAA18711@starfire.mn.org> Subject: patch for rc and sysconfig for dedicated dial-up connections To: hackers@FreeBSD.org (FreeBSD hackers) Date: Fri, 4 Oct 1996 14:03:06 -0500 (CDT) X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk I don't know if anyone else is using FreeBSD for this much, but here're patches to /etc/rc and /etc/sysconfig to delay the running of ntpdate and xntpd for a user-defined amount of time to wait for their dialup connection to come up. It isn't foolproof, of course, since I don't actually wait for ppp0 (or something) to come up, but it has been very useful to me. The results of NOT doing something like this is that the nptdate will hang until name resolution fails, or, if the host(s) are in the /etc/hosts file, it will simply fail when it can't reach the hosts, and xntpd is pretty poorly behaved when it gets "host unreachable" right out of the gate -- it will NEVER find the servers or be able to do anything useful, until is is terminated and started over once the link is available. I don't like this "dead-reckoning wait" kind of solution, but if someone can suggest a better method that is still reasonable to implement and understand, and is NO LESS LIKELY to work ;-), I'll certainly switch to it. BTW, I use two minutes (dialip=120) which has so far been somewhat more than generous, but better to be a few seconds late than a fraction early... diff -c orig/rc etc/rc *** orig/rc Fri Oct 4 13:44:36 1996 --- etc/rc Fri Oct 4 13:47:42 1996 *************** *** 159,169 **** --- 159,174 ---- # $ntpdate and $xntpdflags are imported from /etc/sysconfig. # If $ntpdate != NO, run ntpdate $ntpdate to set the date correctly. # If $xntpdflags != NO, start xntpd. + # If dialip is != NO, then delay by the value of dialip (in seconds) + # before starting either or both of ntpdate or xntpd, but allow + # system initilization to continue (or the dialup will never + # happen..). if [ "X${ntpdate}" != X"NO" -o "X${xntpdflags}" != X"NO" ]; then if [ "X${tickadjflags}" != X"NO" ]; then echo -n ' tickadj'; tickadj ${tickadjflags--Aq} fi + if [ "X${dialip}" = X"NO" ]; then if [ "X${ntpdate}" != X"NO" ]; then echo -n ' ntpdate'; ntpdate ${ntpdate} >/dev/null 2>&1 fi *************** *** 171,176 **** --- 176,190 ---- if [ "X${xntpdflags}" != X"NO" ]; then echo -n ' xntpd'; xntpd ${xntpdflags} fi + else + if [ "X${xntpdflags}" = X"NO" ]; then + echo -n ' ntpdate'; (sleep ${dialip} ; ntpdate ${ntpdate} >/dev/null 2>&1 ) & + elif [ "X${ntpdate}" = X"NO" ]; then + echo -n ' xntpd'; (sleep ${dialip} ; xntpd ${xntpdflags} )& + else + echo -n ' ntpdate xntpd'; (sleep ${dialip} ; ntpdate ${ntpdate} >/dev/null 2>&1; xntpd ${xntpdflags} ) & + fi + fi fi # $timedflags is imported from /etc/sysconfig; diff -c orig/sysconfig etc/sysconfig *** orig/sysconfig Fri Oct 4 13:45:05 1996 --- etc/sysconfig Fri Oct 4 13:45:36 1996 *************** *** 100,105 **** --- 100,110 ---- # timed flags, or NO if you don't want to start the time daemon timedflags=NO + # Set to the number of seconds to delay, for dialup IP, ntpdate and xntpd + # from starting to allow the dialup connection to be established. Set + # to NO to disable -- any other value will be assumed to be a delay. + dialip="NO" + # xntpd flags, or NO if you don't want to start the xntpd daemon xntpdflags="NO" John Lind, Starfire Consulting Services E-mail: john@starfire.MN.ORG USnail: PO Box 17247, Mpls MN 55417