]> git.pld-linux.org Git - packages/monit.git/commitdiff
- use functions
authorElan Ruusamäe <glen@pld-linux.org>
Sun, 1 Oct 2006 22:04:08 +0000 (22:04 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    monit.init -> 1.11

monit.init

index 51feb2af4db9bb701661ec909ff87fff4ea7cf45..a9eef8a1f5743f4abd698ba3bea5d22cc494ac6e 100644 (file)
 # Get service config
 [ -f /etc/sysconfig/monit ] && . /etc/sysconfig/monit
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/monit ]; then
                msg_starting monit
@@ -25,8 +22,9 @@ case "$1" in
        else
                msg_already_running monit
        fi
-       ;;
-  stop)
+}
+
+stop() {
        # Stop daemons.
        if [ -f /var/lock/subsys/monit ]; then
                msg_stopping monit
@@ -35,16 +33,20 @@ case "$1" in
        else
                msg_not_running monit
        fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
        ;;
-  status)
-       status monit
-       monit -c /etc/monitrc status
-       exit $?
+  stop)
+       stop
        ;;
   restart)
-       $0 stop
-       $0 start
-       exit $?
+       stop
+       start
        ;;
   reload|force-reload)
        if [ -f /var/lock/subsys/monit ]; then
@@ -56,6 +58,11 @@ case "$1" in
                exit 7
        fi
        ;;
+  status)
+       status monit
+       monit -c /etc/monitrc status
+       exit $?
+       ;;
   *)
        msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
        exit 3
This page took 0.069207 seconds and 4 git commands to generate.