#! /bin/sh

# /etc/init.d/ntp: start and stop the ntpclient

NTP=/usr/bin/ntpclient
NTPSERVER=10.81.0.1

test -x $NTP || exit 0

case "$1" in
	start)
		echo "Intial date jump set"
		$NTP -sh $NTPSERVER &> /dev/null

		echo "Start NTP into lock mode"
		start-stop-daemon -S -x $NTP -- -lh $NTPSERVER &> /dev/null &
		echo "."
		;;
	stop)
		# Stopping openscada
		start-stop-daemon -K -x $NTP
		;;
	restart)
		$0 stop
		$0 start
		;;

  *)
	echo "Usage: /etc/init.d/ntp {start|stop|restart}"
	exit 1
esac

exit 0
