3 # ntp This shell script takes care of starting and stopping
6 # chkconfig: 2345 55 10
7 # description: ntp is the NTP daemon.
9 # Source function library.
10 . /etc/rc.d/init.d/functions
12 # Source networking configuration.
13 . /etc/sysconfig/network
15 # Source ntp configuration
18 # Check that networking is up.
19 if is_yes "${NETWORKING}"; then
20 if [ ! -f /var/lock/subsys/network ]; then
21 # nls "ERROR: Networking is down. %s can't be run." <service>
29 [ -x /usr/sbin/ntpd -a -f /etc/ntp/ntp.conf ] || exit 0
32 # See how we were called.
35 # Check if the service is already running?
36 if [ ! -f /var/lock/subsys/ntp ]; then
37 if is_yes "$SYNC_TIME"; then
38 # Adjust time to make life easy for ntp
39 run_cmd "Syncing time for ntp" "/usr/sbin/ntpdate $NTPDATE_OPTIONS $NTPDATE_SERVERS"
42 daemon ntpd -c /etc/ntp/ntp.conf
44 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ntp
46 msg_already_running ntp
50 if [ -f /var/lock/subsys/ntp ]; then
53 rm -f /var/lock/subsys/ntp
68 msg_usage "$0 {start|stop|restart|force-reload|status}"