[comp.protocols.time.ntp] ntpd startup option

hagan@scotty.dccs.upenn.edu (John Dotts Hagan) (10/19/90)

I start ntpd from /etc/rc.local upon boot, and I bet most people do.

Sometimes my system has a very bad idea of the time - like off by MONTHS or
YEARS due
to a clock battery problem, changing a failed CPU, or whatever.

The point is, I want ntpd to fix the time using the STEP function.  However, it
decides that
the time is "like, too radical man" to just STEP.  So I have to do a "ntp -s -f
<some-ticker>".
In fact, I have this "nifty" script:

#!/bin/csh -f

set path = ( /usr/bin /usr/ucb /bin /usr/local/bin $path )
ntp -s -f `egrep "^(peer|server)" < /etc/ntp.conf | awk '{print $2}'`


That works pretty well, but it is a pain that I have to do something like:

#
#  @(#)rc.local	1.1 (ULTRIX) 3/2/89
             .
   ...stuff deleted...
             .
# Begin local junk
[ -f /usr/local/bin/ntp-setup ] && {
	/usr/local/bin/ntp-startup				>/dev/console
}
[ -f /usr/local/bin/ntpd ] && {
	/usr/local/bin/ntpd & echo ' ntpd'			>/dev/console
}


How about an option to ntpd like "ntpd -b" meaning "yo ntpd, please do the ntp
thing but keep
in mind you are being called at boot time - so if you have to get huge with the
system clock and
change it wildly, go for it."

Does that sound reasonable?  I think it should be willing to shift the system
clock beyond
CLOCK.MAX (it think that was it) only once (initally).  Then, it would act like
it does now.

--Kid.

rusty@GARNET.BERKELEY.EDU (rusty wright) (10/20/90)

Let's have a contest for the most hairy scripts that start ntp!  I use
xntpd, tickadj, and ntpdate.  Here's my script:

#! /bin/sh

NTPDIR=/usr/local/etc

if test -f ${NTPDIR}/tickadj
then
	${NTPDIR}/tickadj -A -q
	(echo -n ' tickadj')
fi

if test -f ${NTPDIR}/ntpdate
then
	${NTPDIR}/ntpdate -bs \
		tuna.berkeley.edu \
		anchovy.berkeley.edu \
		belch.berkeley.edu \
		sardine.berkeley.edu \
		shark.berkeley.edu \
		sigh.berkeley.edu \
		grunt.berkeley.edu \
		smelt.berkeley.edu
	(echo -n ' ntpdate')
fi

if test -f ${NTPDIR}/xntpd -a -f ${NTPDIR}/xntp.conf
then
	${NTPDIR}/xntpd -c ${NTPDIR}/xntp.conf
	(echo -n ' xntpd')
fi