Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Oct 1996 14:03:06 -0500 (CDT)
From:      john@starfire.mn.org
To:        hackers@FreeBSD.org (FreeBSD hackers)
Subject:   patch for rc and sysconfig for dedicated dial-up connections
Message-ID:  <199610041903.OAA18711@starfire.mn.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610041903.OAA18711>