]>
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. | |
bde59677 | 24 | if is_yes "${NETWORKING}"; then |
25 | if [ ! -f /var/lock/subsys/network ]; then | |
26 | msg_network_down "snmptrapd" | |
27 | exit 1 | |
28 | fi | |
29 | else | |
30 | exit 0 | |
43f17c64 AF |
31 | fi |
32 | ||
420a159a | 33 | |
43f17c64 AF |
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 | exit 1 | |
46 | fi | |
47 | ;; | |
48 | stop) | |
49 | if [ -f /var/lock/subsys/snmptrapd ]; then | |
50 | msg_stopping "snmptrapd" | |
51 | killproc snmptrapd | |
52 | rm -f /var/lock/subsys/snmptrapd >/dev/null 2>&1 | |
53 | else | |
54 | msg_not_running "snmptrapd" | |
55 | exit 1 | |
56 | fi | |
57 | ;; | |
58 | restart|reload) | |
59 | $0 stop | |
60 | $0 start | |
61 | ;; | |
62 | status) | |
63 | status snmptrapd | |
64 | exit $? | |
65 | ;; | |
66 | *) | |
bde59677 | 67 | msg_usage "$0 {start|stop|restart|reload|status}" |
43f17c64 AF |
68 | exit 1 |
69 | esac | |
70 | ||
71 | exit $RETVAL |