3 # ntpdate This shell script synchronizes time with ntpdate (NTP client)
5 # chkconfig: 2345 55 10
6 # description: ntpdate is the NTP client.
8 # Source function library.
9 . /etc/rc.d/init.d/functions
11 # Source networking configuration.
12 . /etc/sysconfig/network
14 # if not specified in config
17 # Source ntp configuration
18 . /etc/sysconfig/ntpdate
20 # Check that networking is up.
21 if is_yes "${NETWORKING}"; then
22 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
23 msg_network_down "ntpdate"
30 ntpdate_background() {
31 /usr/sbin/ntpdate -s ${NTPDATE_USER:+-U $NTPDATE_USER} $NTPDATE_OPTIONS $NTPDATE_SERVERS || return $?
33 if is_yes "$SYNC_HWCLOCK"; then
34 /sbin/hwclock --systohc
39 show "Syncing time with ntpdate (backgrounding)"
41 touch /var/lock/subsys/ntpdate
46 rm -f /var/lock/subsys/ntpdate
50 # See how we were called.
63 is_yes "$NTPDATE_CRON" && /usr/sbin/ntpdate -s ${NTPDATE_USER:+-U $NTPDATE_USER} $NTPDATE_OPTIONS $NTPDATE_SERVERS
67 msg_usage "$0 {start|restart|force-reload}"