]> git.pld-linux.org Git - packages/ntp.git/blobdiff - ntpdate.init
rename rc scripts/config to match service names
[packages/ntp.git] / ntpdate.init
diff --git a/ntpdate.init b/ntpdate.init
new file mode 100755 (executable)
index 0000000..73ba5b0
--- /dev/null
@@ -0,0 +1,69 @@
+#!/bin/sh
+#
+# ntpdate              This shell script synchronizes time with ntpdate (NTP client)
+#
+# chkconfig:   2345 16 89
+# description: ntpdate is the NTP client.
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+upstart_controlled
+
+# Source networking configuration.
+. /etc/sysconfig/network
+
+# if not specified in config
+NTPDATE_USER="ntp"
+
+# Source ntp configuration
+. /etc/sysconfig/ntpdate
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+               msg_network_down "ntpdate"
+               exit 1
+       fi
+else
+       exit 0
+fi
+
+ntpdate_background() {
+       /usr/sbin/ntpdate -s ${NTPDATE_USER:+-U $NTPDATE_USER} $NTPDATE_OPTIONS $NTPDATE_SERVERS || return $?
+
+       if is_yes "$SYNC_HWCLOCK"; then
+               /sbin/hwclock --systohc
+       fi
+}
+
+start() {
+       show "Syncing time with ntpdate (backgrounding)"
+       ntpdate_background &
+       touch /var/lock/subsys/ntpdate
+       ok
+}
+
+stop() {
+       rm -f /var/lock/subsys/ntpdate
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+start)
+       start
+       ;;
+stop)
+       stop
+       ;;
+restart|force-reload)
+       stop
+       start
+       ;;
+*)
+       msg_usage "$0 {start|restart|force-reload}"
+       exit 3
+esac
+
+exit $RETVAL
This page took 0.076242 seconds and 4 git commands to generate.