#!/bin/sh # # ntp This shell script takes care of starting and stopping # ntp (NTP client). # # chkconfig: 2345 55 10 # description: ntp is the NTP client. # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Source ntp configuration . /etc/sysconfig/ntp # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then # nls "ERROR: Networking is down. %s can't be run." msg_network_down ntp exit 1 fi else exit 0 fi [ -x /usr/sbin/ntpdate ] || exit 0 RETVAL=0 # See how we were called. case "$1" in start) if is_yes "$SYNC_TIME"; then # Adjust time run_cmd "Syncing time for ntp" "/usr/sbin/ntpdate $NTPDATE_OPTIONS $NTPDATE_SERVERS" RETVAL=$? fi ;; stop) exit $RETVAL ;; restart|force-reload) $0 start exit $? ;; *) msg_usage "$0 {start|restart|force-reload}" exit 3 esac exit $RETVAL