Ntp/init file

To install the below INIT file on a Fedora system, first add the below to /etc/init.d/ntpd. After the file has been created with the below text, run: touch /etc/sysconfig/ntpd chmod 755 /etc/init.d/ntpd chkconfig --add ntpd chkconfig ntpd on

This file should be named: /etc/init.d/ntpd
 * 1) !/bin/bash
 * 2) ntpd          This shell script takes care of starting and stopping
 * 3)               ntpd (NTPv4 daemon).
 * 4) chkconfig: - 58 74
 * 5) description: ntpd is the NTPv4 daemon. \
 * 6) The Network Time Protocol (NTP) is used to synchronize the time of \
 * 7) a computer client or server to another server or reference time source, \
 * 8) such as a radio or satellite receiver or modem.
 * 1) a computer client or server to another server or reference time source, \
 * 2) such as a radio or satellite receiver or modem.


 * 1) BEGIN INIT INFO
 * 2) Provides: ntpd
 * 3) Required-Start: $network $local_fs $remote_fs
 * 4) Required-Stop: $network $local_fs $remote_fs
 * 5) Should-Start: $syslog $named ntpdate
 * 6) Should-Stop: $syslog $named
 * 7) Short-Description: start and stop ntpd
 * 8) Description: ntpd is the NTPv4 daemon. The Network Time Protocol (NTP)
 * 9)              is used to synchronize the time of a computer client or
 * 10)              server to another server or reference time source, such
 * 11)              as a radio or satellite receiver or modem.
 * 12) END INIT INFO

. /etc/init.d/functions
 * 1) Source function library.

. /etc/sysconfig/network
 * 1) Source networking configuration.

prog=ntpd lockfile=$prog

start { [ "$EUID" != "0" ] && exit 4 [ "$NETWORKING" = "no" ] && exit 1 [ -x /usr/local/sbin/ntpd ] || exit 5 [ -f /etc/sysconfig/ntpd ] || exit 6 . /etc/sysconfig/ntpd

# Start daemon. echo -n $"Starting $prog: " daemon /usr/local/sbin/$prog -u ntp:ntp -p /var/run/ntpd.pid $OPTIONS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch $lockfile return $RETVAL }

stop { [ "$EUID" != "0" ] && exit 4 echo -n $"Shutting down $prog: " killproc $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $lockfile return $RETVAL }

case "$1" in start)        start        ;;  stop) stop ;; status)        status $prog        ;;  restart|force-reload) stop start ;; try-restart|condrestart)        if status $prog > /dev/null; then            stop            start        fi        ;;  reload) exit 3 ;; *)        echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"        exit 2 esac
 * 1) See how we were called.