]> git.pld-linux.org Git - packages/net-snmp.git/blobdiff - net-snmptrapd.init
- release 6 (by relup.sh)
[packages/net-snmp.git] / net-snmptrapd.init
old mode 100644 (file)
new mode 100755 (executable)
index a552788..eb97ffd
@@ -33,10 +33,7 @@ else
        exit 0
 fi
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/snmptrapd ]; then
                msg_starting "snmptrapd"
@@ -46,8 +43,9 @@ case "$1" in
        else
                msg_already_running "snmptrapd"
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/snmptrapd ]; then
                msg_stopping "snmptrapd"
                killproc snmptrapd
@@ -55,18 +53,43 @@ case "$1" in
        else
                msg_not_running "snmptrapd"
        fi
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/snmptrapd ]; then
+               stop
+               start
+       else
+               msg_not_running "snmptrapd"
+               RETVAL=$1
+       fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
        ;;
-  restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
        ;;
   status)
        status snmptrapd
        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.078215 seconds and 4 git commands to generate.