#! /bin/sh
#
# Name: ntpdate  
# Date: 2006-07-24 10:40
# Author: MontaVista Software, Inc. <source@mvista.com>
# Copyright: Copyright 1999-2003 MontaVista Software, Inc.
# License: 2003 (c) MontaVista Software, Inc. This file is licensed
#          under the terms of the GNU General Public License version 2.
#          This program is licensed "as is" without any warranty of any
#          kind, whether express or implied.
  #
# Copyright 2002, 2003, 2004 Sony Corporation
# Copyright 2002, 2003, 2004 Matsushita Electric Industrial Co., Ltd.
#
### BEGIN INIT INFO
# Required-Start: 
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: S
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: start/stop ntpdate daemon
# Description: set the local machine time from remote machines running NTP.
### END INIT INFO 
# We run as soon as networking is live, and before we use NFS!
# chkconfig: S 41 0
#

PATH=/sbin:/bin

test -f /usr/sbin/ntpdate || exit 0
test -f /etc/default/ntpdate || exit 0

. /etc/default/ntpdate

test -n "$NTPSERVERS" || exit 0

case "$1" in
start|force-reload)
  echo -n "Running ntpdate to synchronize clock"
  /usr/sbin/ntpdate -u -b -s $NTPSERVERS
  echo "."
  ;;
restart|reload)
  # Drop -b to slew clock rather than step it if called after system is up
  echo -n "Running ntpdate to synchronize clock"
  /usr/sbin/ntpdate -u -s $NTPSERVERS
  echo "."
  ;;
stop)
  ;;
*)
  echo "Usage: /etc/init.d/ntpdate {start|stop|restart|reload|force-reload}"
  exit 1
esac

exit 0
