#! /bin/sh
#
# Name: ntp  
# 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: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start/stop ntp daemon
# Description: start and stop Network Time Protocol  daemon
### END INIT INFO 
# chkconfig: 2345 23 23
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin

PATH=/sbin:/bin
FLAGS="defaults 23"
ARGS1=

[ -e /etc/default/ntp ] && . /etc/default/ntp
test -f /usr/sbin/ntpd || exit 0

case "$1" in
	start)
		rm -f /var/run/ntpd.pid 
		echo -n "Starting NTP server: ntpd"
 		start-stop-daemon --start --quiet --exec /usr/sbin/ntpd -- $ARGS1
		echo "."
  		;;
	stop)
		echo -n "Stopping NTP server: ntpd"
  		start-stop-daemon --stop --quiet -n ntpd
		echo "."
  		;;
	restart|force-reload)
		echo -n "Restarting NTP server: ntpd... "
  		start-stop-daemon --stop --quiet -n ntpd
  		sleep 2
  		start-stop-daemon --start --quiet --exec /usr/sbin/ntpd -- $ARGS1
		echo "done."
  		;;
	*)
  		echo "Usage: /etc/init.d/ntp {start|stop|restart|force-reload}"
  		exit 1
		;;
esac

exit 0
