]> git.pld-linux.org Git - packages/ntp.git/blobdiff - ntp-client.init
- missing BR: pciutils-devel
[packages/ntp.git] / ntp-client.init
index 99211d75f812be2681942d5307023667b2875142..ff624c597a8adfe3deb15d45beef1705534beb72 100644 (file)
@@ -2,15 +2,20 @@
 #
 # ntpdate              This shell script synchronizes time with ntpdate (NTP client)
 #
-# chkconfig:   2345 55 10
+# chkconfig:   2345 16 89
 # description: ntpdate is the NTP client.
 
 # Source function library.
 . /etc/rc.d/init.d/functions
 
+upstart_controlled --except cronsettime
+
 # Source networking configuration.
 . /etc/sysconfig/network
 
+# if not specified in config
+NTPDATE_USER="ntp"
+
 # Source ntp configuration
 . /etc/sysconfig/ntpdate
 
@@ -24,19 +29,21 @@ else
        exit 0
 fi
 
-start() {
-       show "Syncing time with ntpdate"
-       daemon /usr/sbin/ntpdate -s $NTPDATE_OPTIONS $NTPDATE_SERVERS
-       RETVAL=$?
-       if [ $RETVAL -eq 0 ]; then
-               touch /var/lock/subsys/ntpdate
-               if is_yes "$SYNC_HWCLOCK"; then
-                       show "Syncing hardware clock to system time"
-                   /sbin/hwclock --systohc && ok || fail
-               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
 }
@@ -55,7 +62,7 @@ restart|force-reload)
        start
        ;;
 cronsettime)
-       is_yes "$NTPDATE_CRON" && /usr/sbin/ntpdate -s $NTPDATE_OPTIONS $NTPDATE_SERVERS > /dev/null 2>&1
+       is_yes "$NTPDATE_CRON" && /usr/sbin/ntpdate -s ${NTPDATE_USER:+-U $NTPDATE_USER} $NTPDATE_OPTIONS $NTPDATE_SERVERS
        RETVAL=$?
        ;;
 *)
This page took 0.026718 seconds and 4 git commands to generate.