]> git.pld-linux.org Git - packages/net-snmp.git/blobdiff - net-snmptrapd.init
- perl req/prov fix
[packages/net-snmp.git] / net-snmptrapd.init
old mode 100644 (file)
new mode 100755 (executable)
index 28593c7..eb97ffd
@@ -17,6 +17,9 @@
 # Get network config
 . /etc/sysconfig/network
 
+# Define initial value:
+SNMPTRAPD_OPTIONS=""
+
 # Get service config
 [ -f /etc/sysconfig/snmpd ] && . /etc/sysconfig/snmptrapd
 
@@ -30,40 +33,63 @@ 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"
-               daemon /usr/sbin/snmptrapd
+               daemon /usr/sbin/snmptrapd $SNMPTRAPD_OPTIONS
                RETVAL=$?
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmptrapd
        else
                msg_already_running "snmptrapd"
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/snmptrapd ]; then
                msg_stopping "snmptrapd"
                killproc snmptrapd
                rm -f /var/lock/subsys/snmptrapd >/dev/null 2>&1
        else
                msg_not_running "snmptrapd"
-       fi      
+       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.11508 seconds and 4 git commands to generate.