3 # ntpdate This shell script synchronizes time with ntpdate (NTP client)
5 # chkconfig: 2345 16 89
6 # description: ntpdate is the NTP client.
8 # Source function library.
9 . /etc/rc.d/init.d/functions
11 upstart_controlled --except cronsettime
13 # Source networking configuration.
14 . /etc/sysconfig/network
16 # if not specified in config
19 # Source ntp configuration
20 . /etc/sysconfig/ntpdate
22 # Check that networking is up.
23 if is_yes "${NETWORKING}"; then
24 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
25 msg_network_down "ntpdate"
32 ntpdate_background() {
33 /usr/sbin/ntpdate -s ${NTPDATE_USER:+-U $NTPDATE_USER} $NTPDATE_OPTIONS $NTPDATE_SERVERS || return $?
35 if is_yes "$SYNC_HWCLOCK"; then
36 /sbin/hwclock --systohc
41 show "Syncing time with ntpdate (backgrounding)"
43 touch /var/lock/subsys/ntpdate
48 rm -f /var/lock/subsys/ntpdate
52 # See how we were called.
65 is_yes "$NTPDATE_CRON" && /usr/sbin/ntpdate -s ${NTPDATE_USER:+-U $NTPDATE_USER} $NTPDATE_OPTIONS $NTPDATE_SERVERS
69 msg_usage "$0 {start|restart|force-reload}"