]> git.pld-linux.org Git - packages/net-snmp.git/blobdiff - net-snmptrapd.init
- use functions
[packages/net-snmp.git] / net-snmptrapd.init
index 28593c775d64b149fadb0bc725135b57f4a1e558..476867c3f57fce0223cd26e988b2ef3c9176c227 100644 (file)
@@ -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,33 +33,40 @@ 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
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
        ;;
   restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
+       stop
+       start
        ;;
   status)
        status snmptrapd
This page took 0.935028 seconds and 4 git commands to generate.