]> git.pld-linux.org Git - packages/chrony.git/blobdiff - chronyd.init
- up to 2.1.1
[packages/chrony.git] / chronyd.init
index 23658482d8b087edc623cf884597e00e754e0e75..d259623595468d3034241f6853c67302fa6fd4a2 100644 (file)
@@ -14,6 +14,9 @@
 # Get network config
 . /etc/sysconfig/network
 
+# default user if not overriden by config
+NTPD_USER="ntp"
+
 # Get service config - may override defaults
 [ -f /etc/sysconfig/chronyd ] && . /etc/sysconfig/chronyd
 
@@ -52,8 +55,8 @@ $1
 EOF
         chronycpid=$!
 
-        # chronyc will hang if the daemon doesn't respond, kill it after 3 s 
-        (sleep 3; kill $chronycpid) < /dev/null &> /dev/null &
+        # chronyc will hang if the daemon doesn't respond, kill it after 3 s
+        (sleep 3; kill $chronycpid) < /dev/null > /dev/null 2>&1 &
         killerpid=$!
 
         wait $chronycpid &> /dev/null
@@ -67,11 +70,9 @@ generate_commandkey() {
     commandkey=$(get_key $commandkeyid)
     [ -z "$commandkey" ] || return 0
 
-    echo -n $"Generating chrony command key: "
+       show "Generating Chrony command key"; busy
     commandkey=$(tr -c -d '[\041-\176]' < /dev/urandom | head -c 8)
-    [ -n "$commandkey" ] && echo "$commandkeyid $commandkey" >> $keyfile &&
-        success || failure
-    echo
+    [ -n "$commandkey" ] && echo "$commandkeyid $commandkey" >> $keyfile && ok || fail
 }
 
 start() {
@@ -84,7 +85,7 @@ start() {
     generate_commandkey
 
        msg_starting "Chronyd NTPD"
-       daemon /usr/sbin/chronyd $OPTIONS
+       daemon /usr/sbin/chronyd -u $NTPD_USER $OPTIONS
        RETVAL=$?
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/chronyd
 }
@@ -131,7 +132,11 @@ case "$1" in
   force-reload)
        condrestart 7
        ;;
-  online|offline|cyclelogs) 
+  cyclelogs|flush-logs)
+       status chronyd >/dev/null 2>&1 || exit 7
+       chrony_command cyclelogs
+       ;;
+  online|offline)
        status chronyd >/dev/null 2>&1 || exit 7
        chrony_command $1
        ;;
@@ -142,6 +147,9 @@ case "$1" in
   status)
        status chronyd
        RETVAL=$?
+       if [ $RETVAL = 0 ]; then
+               chrony_command sources
+       fi
        ;;
   *)
        msg_usage "$0 {start|stop|restart|try-restart|force-reload|online|offline|cyclelogs|command|status}"
This page took 0.129976 seconds and 4 git commands to generate.