#! /bin/bash # # ntpd Time synchronization daemon # # chkconfig: - 90 60 # description: ntpd is a time synchronization daemon # processname: ntpd # config: /etc/ntpd.conf # pidfile: /var/run/ntpd.pid # Source function library. WITHOUT_RC_COMPAT=1 . /etc/init.d/functions # Source networking configuration. SourceIfNotEmpty /etc/sysconfig/network # Source ntpd configuration. NTPD_ARGS= SourceIfNotEmpty /etc/sysconfig/ntpd NTPD_USER=ntpd LOCKFILE=/var/lock/subsys/ntpd RETVAL=0 start() { is_yes "$NETWORKING" || return 0 start_daemon --lockfile "$LOCKFILE" --expect-user "$NTPD_USER" -- ntpd $NTPD_ARGS RETVAL=$? return $RETVAL } stop() { stop_daemon --lockfile "$LOCKFILE" --expect-user "$NTPD_USER" -- ntpd RETVAL=$? return $RETVAL } ntp_status() { status --lockfile "$LOCKFILE" --expect-user "$NTPD_USER" -- ntpd RETVAL=$? return $RETVAL } restart() { stop start } # See how we were called. case "$1" in start) start ;; stop) stop ;; reload|restart) restart ;; status) ntp_status ;; condstop) if [ -e "$LOCKFILE" ]; then stop fi ;; condreload|condrestart) if [ -e "$LOCKFILE" ]; then restart fi ;; *) msg_usage "${0##*/} {start|stop|reload|restart|status|condstop|condreload|condrestart}" RETVAL=1 esac exit $RETVAL