]> git.pld-linux.org Git - packages/ntp.git/blobdiff - ntp.init
- rel 2
[packages/ntp.git] / ntp.init
index 3eef4945cf1a148489e8ea5239e923e6e7e8c4f8..b569e6f445004bf68ebf458c0560fe32f326502e 100644 (file)
--- a/ntp.init
+++ b/ntp.init
@@ -9,6 +9,8 @@
 # Source function library.
 . /etc/rc.d/init.d/functions
 
+upstart_controlled
+
 # Source networking configuration.
 . /etc/sysconfig/network
 
@@ -18,7 +20,7 @@
 # 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 ntpd
+               msg_network_down "ntpd"
                exit 1
        fi
 else
@@ -30,22 +32,32 @@ fi
 start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/ntpd ]; then
-               msg_starting ntpd
-               daemon ntpd -c /etc/ntp/ntp.conf $NTPD_OPTIONS
+               msg_starting "ntpd"
+               daemon /usr/sbin/ntpd -c /etc/ntp/ntp.conf -p /var/run/ntpd.pid -u ntp:ntp $NTPD_OPTIONS
                RETVAL=$?
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ntpd
        else
-               msg_already_running ntp
+               msg_already_running "ntpd"
        fi
 }
 
 stop() {
        if [ -f /var/lock/subsys/ntpd ]; then
-               msg_stopping ntpd
+               msg_stopping "ntpd"
                killproc ntpd
                rm -f /var/lock/subsys/ntpd
        else
-               msg_not_running ntpd
+               msg_not_running "ntpd"
+       fi
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/ntpd ]; then
+               stop
+               start
+       else
+               msg_not_running "ntpd"
+               RETVAL=$1
        fi
 }
 
@@ -58,23 +70,23 @@ case "$1" in
   stop)
        stop
        ;;
+  restart)
+       stop
+       start
+       ;;
+  # NB! don't remove 'condrestart': dhcpcd calls this
+  try-restart|condrestart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
+       ;;
   status)
        status ntpd
        exit $?
        ;;
-  restart|force-reload)
-       stop
-       start
-       ;;
-  conditionalrestart)
-       # NB! don't remove: dhcpcd calls this
-       if [ -f /var/lock/subsys/ntpd ]; then
-               stop
-               start
-       fi
-       ;;
   *)
-       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|condrestart|status}"
        exit 3
 esac
 
This page took 0.035425 seconds and 4 git commands to generate.