#!/bin/sh # # ntpd This shell script takes care of starting and stopping # ntpd (NTPv4 daemon). # # chkconfig: 35 55 10 # description: ntpd is the NTPv4 daemon. WITHOUT_RC_COMPAT=1 # Source function library. . /etc/init.d/functions # Source networking configuration. SourceIfNotEmpty /etc/sysconfig/network # Source service configuration. SourceIfNotEmpty /etc/sysconfig/ntpd NTPDATE=/usr/sbin/ntpdate NTPD=/usr/sbin/ntpd LOCKFILE=/var/lock/subsys/ntpd RETVAL=0 start() { is_yes "$NETWORKING" || return 0 # Adjust time to make life easy for ntpd. if grep -qvs '^#' /etc/ntp/step-tickers; then action $"Synchronizing with time server:" \ "$NTPDATE" -s -b -p 8 $NTPDATE_OPTIONS -u "`/bin/sed -e 's/#.*//' /etc/ntp/step-tickers`" fi start_daemon --lockfile "$LOCKFILE" --expect-user ntpd -- ntpd $NTPD_OPTIONS RETVAL=$? return $RETVAL } stop() { stop_daemon --lockfile "$LOCKFILE" --expect-user ntpd -- ntpd RETVAL=$? return $RETVAL } restart() { stop start } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|reload) restart ;; condstop) if [ -e "$LOCKFILE" ]; then stop fi ;; condrestart) if [ -e "$LOCKFILE" ]; then restart fi ;; status) status --expect-user ntpd -- ntpd RETVAL=$? ;; *) msg_usage "${0##*/} {start|stop|restart|condstop|condrestart|status}" RETVAL=1 esac exit $RETVAL