]>
Commit | Line | Data |
---|---|---|
43f17c64 AF |
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_no "${NETWORKING}"; then | |
25 | msg_network_down "snmptrapd" | |
26 | exit 1 | |
27 | fi | |
28 | ||
29 | # See how we were called. | |
30 | case "$1" in | |
31 | start) | |
32 | # Check if the service is already running? | |
33 | if [ ! -f /var/lock/subsys/snmptrapd ]; then | |
34 | msg_starting "snmptrapd" | |
35 | daemon /usr/sbin/snmptrapd | |
36 | RETVAL=$? | |
37 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmptrapd | |
38 | else | |
39 | msg_already_running "snmptrapd" | |
40 | exit 1 | |
41 | fi | |
42 | ;; | |
43 | stop) | |
44 | if [ -f /var/lock/subsys/snmptrapd ]; then | |
45 | msg_stopping "snmptrapd" | |
46 | killproc snmptrapd | |
47 | rm -f /var/lock/subsys/snmptrapd >/dev/null 2>&1 | |
48 | else | |
49 | msg_not_running "snmptrapd" | |
50 | exit 1 | |
51 | fi | |
52 | ;; | |
53 | restart|reload) | |
54 | $0 stop | |
55 | $0 start | |
56 | ;; | |
57 | status) | |
58 | status snmptrapd | |
59 | exit $? | |
60 | ;; | |
61 | *) | |
62 | msg_usage "$0 {start|stop|status|restart|reload}" | |
63 | exit 1 | |
64 | esac | |
65 | ||
66 | exit $RETVAL |