]> git.pld-linux.org Git - packages/net-snmp.git/blob - net-snmptrapd.init
- fixed previous change
[packages/net-snmp.git] / net-snmptrapd.init
1 #!/bin/sh
2 #
3 # ucd-snmptrapd Simple Network Management Protocol (SNMP) Trap Daemon
4 #
5 # chkconfig:    345 51 51
6 #
7 # description:  Simple Network Management Protocol (SNMP) Trap Daemon
8 #
9 # processname:  snmptrapd
10 # config:       /etc/snmp/snmptrapd.local.conf
11 # config:       /etc/snmp/snmptrapd.conf
12
13
14 # Source function library
15 . /etc/rc.d/init.d/functions
16
17 # Get network config
18 . /etc/sysconfig/network
19
20 # Get service config
21 [ -f /etc/sysconfig/snmpd ] && . /etc/sysconfig/snmptrapd
22
23 # Check that networking is up.
24 if is_yes "${NETWORKING}"; then
25         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
26                 msg_network_down "snmptrapd"
27                 exit 1
28         fi
29 else
30         exit 0
31 fi
32
33 RETVAL=0
34 # See how we were called.
35 case "$1" in
36   start)
37         # Check if the service is already running?
38         if [ ! -f /var/lock/subsys/snmptrapd ]; then
39                 msg_starting "snmptrapd"
40                 daemon /usr/sbin/snmptrapd
41                 RETVAL=$?
42                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmptrapd
43         else
44                 msg_already_running "snmptrapd"
45         fi
46         ;;
47   stop)
48         if [ -f /var/lock/subsys/snmptrapd ]; then
49                 msg_stopping "snmptrapd"
50                 killproc snmptrapd
51                 rm -f /var/lock/subsys/snmptrapd >/dev/null 2>&1
52         else
53                 msg_not_running "snmptrapd"
54         fi      
55         ;;
56   restart|force-reload)
57         $0 stop
58         $0 start
59         exit $?
60         ;;
61   status)
62         status snmptrapd
63         exit $?
64         ;;
65   *)
66         msg_usage "$0 {start|stop|restart|force-reload|status}"
67         exit 3
68 esac
69
70 exit $RETVAL
This page took 0.465706 seconds and 4 git commands to generate.