]>
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 | ||
eca273bc PG |
20 | # Define initial value: |
21 | SNMPTRAPD_OPTIONS="" | |
22 | ||
43f17c64 AF |
23 | # Get service config |
24 | [ -f /etc/sysconfig/snmpd ] && . /etc/sysconfig/snmptrapd | |
25 | ||
26 | # Check that networking is up. | |
bde59677 | 27 | if is_yes "${NETWORKING}"; then |
8d056991 | 28 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
bde59677 | 29 | msg_network_down "snmptrapd" |
30 | exit 1 | |
31 | fi | |
32 | else | |
33 | exit 0 | |
43f17c64 AF |
34 | fi |
35 | ||
10206900 | 36 | start() { |
43f17c64 AF |
37 | # Check if the service is already running? |
38 | if [ ! -f /var/lock/subsys/snmptrapd ]; then | |
39 | msg_starting "snmptrapd" | |
eca273bc | 40 | daemon /usr/sbin/snmptrapd $SNMPTRAPD_OPTIONS |
43f17c64 AF |
41 | RETVAL=$? |
42 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmptrapd | |
43 | else | |
44 | msg_already_running "snmptrapd" | |
43f17c64 | 45 | fi |
10206900 ER |
46 | } |
47 | ||
48 | stop() { | |
43f17c64 AF |
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" | |
96268f66 | 55 | fi |
10206900 ER |
56 | } |
57 | ||
58 | RETVAL=0 | |
59 | # See how we were called. | |
60 | case "$1" in | |
61 | start) | |
62 | start | |
63 | ;; | |
64 | stop) | |
65 | stop | |
43f17c64 | 66 | ;; |
04a4ae24 | 67 | restart|force-reload) |
10206900 ER |
68 | stop |
69 | start | |
43f17c64 AF |
70 | ;; |
71 | status) | |
72 | status snmptrapd | |
73 | exit $? | |
74 | ;; | |
75 | *) | |
04a4ae24 | 76 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
77 | exit 3 | |
43f17c64 AF |
78 | esac |
79 | ||
80 | exit $RETVAL |