]> git.pld-linux.org Git - packages/sysstat.git/commitdiff
- add try-restart, fix force-reload
authorElan Ruusamäe <glen@pld-linux.org>
Tue, 4 Nov 2008 20:45:51 +0000 (20:45 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    sysstat.init -> 1.12

sysstat.init

index f739dce2748c55a567f944cabdf08a06458ae262..f371c44302d2a801f8aa44e316b0c7cd3b7532bc 100644 (file)
 
 [ -f /etc/sysconfig/sysstat ] && . /etc/sysconfig/sysstat
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/sysstat ]; then
                msg_starting "system activity data collector"
@@ -25,8 +22,9 @@ case "$1" in
        else
                msg_already_running "system activity data collector"
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/sysstat ]; then
                # Stop daemons.
                msg_stopping "system activity data collector"
@@ -35,18 +33,43 @@ case "$1" in
        else
                msg_not_running "system activity data collector"
        fi
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/sysstat ]; then
+               stop
+               start
+       else
+               msg_not_running "system activity data collector"
+               RETVAL=$1
+       fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
        ;;
   status)
        status sysstat
        exit $?
        ;;
-  restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
-       ;;
   *)
-       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
        exit 3
        ;;
 esac
This page took 0.10333 seconds and 4 git commands to generate.