Sophie

Sophie

distrib > Mageia > 2 > i586 > by-pkgid > e808f15af8830b3a17a03d88b55d189f > files > 2

openntpd-3.9p1-7.mga1.src.rpm

#!/bin/bash
#
# ntpd		Time synchronization daemon 
#
# chkconfig: 2345 90 60
# description: ntpd is a time synchronization daemon
# processname: ntpd
# config: /etc/ntpd.conf
# pidfile: /var/run/ntpd.pid

### BEGIN INIT INFO
# Provides: ntpd
# Required-Start: $network
# Should-Start: $named
# Required-Stop: $network
# Should-Stop: $named
# Default-Start: 2 3 4 5
# Short-Description: Synchronizes system time using the Network Time Protocol (NTP)
# Description: The Network Time Protocol (NTP) is used to synchronize a computer's time
#              with another reference time source.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

RETVAL=0

# See how we were called.
  
prog="ntpd"

# Add options, especially -s to set the time correctly as we don't use rdate

NTP_OPT=" -s"

start() {
	echo -n $"Starting $prog: "
	daemon ntpd $NTP_OPT
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ntpd
	return $RETVAL
}

stop() {
	echo -n $"Stopping $prog: "
	killproc ntpd 2>/dev/null
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ntpd
	return $RETVAL
}	

rhstatus() {
	status ntpd
}	

restart() {
  	stop
	start
}	

reload() {
	echo -n $"Reloading ntpd daemon configuration: "
	killproc ntpd -HUP
	retval=$?
	echo
	return $RETVAL
}	

case "$1" in
  start)
  	start
	;;
  stop)
  	stop
	;;
  restart)
  	restart
	;;
  reload)
  	reload
	;;
  status)
  	rhstatus
	;;
  condrestart)
  	[ -f /var/lock/subsys/ntpd ] && restart || :
	;;
  *)
	echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
	exit 1
esac

exit $?