[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xntp3: init script is not very policy-compliant



Package: xntp3
Version: 5.91-8
Severity: important

There are a number of aspects of the existing init script that are not
policy-compliant.  Within this mail is a modified version that is.  (Yes, I
have tested it.)

Also, this should be placed in the xntp3 build tree as debian/init, so that
dh_installinit does the right thing.  Then, the stuff in the postinst that
makes this file can be removed.  This has the added advantage of letting
dpkg handle it.

I added some sophistication to the ntpdate call, as I have found ntpdate
can hang (interminably?) if your gateway is down.  This way at least the
sysadmin knows what is hanging the boot process.

Unfortunately, the options to ntpdate don't really seem to be documented
anywhere, not even in the source code.  -t is "timeout", but it works in
screwy intervals that seem on my system to be units of approximately four
seconds.  (!?!?)

#! /bin/sh
#	/etc/init.d/xntp3: control xntp daemon

[ -f /usr/sbin/xntpd ] && [ -f /usr/sbin/ntpdate ] || exit 0

TIMEHOST1=ntp2.usno.navy.mil
TIMEHOST2=tick.usno.navy.mil
TIMEHOST3=tock.usno.navy.mil

case "$1" in
start)
  echo -n "Synchronizing with time server..."
  ntpdate -b -s -t 1 $TIMEHOST1 $TIMEHOST2 $TIMEHOST3 > /dev/null 2>&1
  if [ $? -ne 0 ]; then
    echo "failed."
  else
    echo "done."
  fi
  echo -n "Starting network time protocol daemon: xntpd"
  start-stop-daemon --start --quiet --exec /usr/sbin/xntpd
  echo "."
  ;;
stop)
  echo -n "Stopping network time protocol daemon: xntpd"
  start-stop-daemon --stop --quiet --exec /usr/sbin/xntpd
  echo "."
  ;;
# xntpd does not seem to support using SIGUSR1 to reload configuration files
#   echo -n "Reloading network time protocol daemon configuration..."
#   start-stop-daemon --stop --signal 10 --quiet --exec /usr/sbin/xntpd
#   echo "done."
#   ;;
restart|reload|force-reload)
  $0 stop
  $0 start
  ;;
*)
  echo "Usage: /etc/init.d/xntp3 {start|stop|restart|reload|force-reload}"
  exit 1
  ;;
esac

exit 0

-- 
G. Branden Robinson                 |         Measure with micrometer,
Purdue University                   |         mark with chalk,
branden@purdue.edu                  |         cut with axe,
http://www.ecn.purdue.edu/~branden/ |         hope like hell.


--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: