]> git.pld-linux.org Git - packages/net-snmp.git/blob - net-snmptrapd.init
- added syntax patch
[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 # Define initial value:
21 SNMPTRAPD_OPTIONS=""
22
23 # Get service config
24 [ -f /etc/sysconfig/snmpd ] && . /etc/sysconfig/snmptrapd
25
26 # Check that networking is up.
27 if is_yes "${NETWORKING}"; then
28         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
29                 msg_network_down "snmptrapd"
30                 exit 1
31         fi
32 else
33         exit 0
34 fi
35
36 RETVAL=0
37 # See how we were called.
38 case "$1" in
39   start)
40         # Check if the service is already running?
41         if [ ! -f /var/lock/subsys/snmptrapd ]; then
42                 msg_starting "snmptrapd"
43                 daemon /usr/sbin/snmptrapd $SNMPTRAPD_OPTIONS
44                 RETVAL=$?
45                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmptrapd
46         else
47                 msg_already_running "snmptrapd"
48         fi
49         ;;
50   stop)
51         if [ -f /var/lock/subsys/snmptrapd ]; then
52                 msg_stopping "snmptrapd"
53                 killproc snmptrapd
54                 rm -f /var/lock/subsys/snmptrapd >/dev/null 2>&1
55         else
56                 msg_not_running "snmptrapd"
57         fi      
58         ;;
59   restart|force-reload)
60         $0 stop
61         $0 start
62         exit $?
63         ;;
64   status)
65         status snmptrapd
66         exit $?
67         ;;
68   *)
69         msg_usage "$0 {start|stop|restart|force-reload|status}"
70         exit 3
71 esac
72
73 exit $RETVAL
This page took 0.065598 seconds and 3 git commands to generate.