]> git.pld-linux.org Git - packages/net-snmp.git/blob - net-snmptrapd.init
Provide hrMIB data via librpm for rpm 4.16
[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 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 $SNMPTRAPD_OPTIONS
41                 RETVAL=$?
42                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmptrapd
43         else
44                 msg_already_running "snmptrapd"
45         fi
46 }
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         fi
56 }
57
58 condrestart() {
59         if [ -f /var/lock/subsys/snmptrapd ]; then
60                 stop
61                 start
62         else
63                 msg_not_running "snmptrapd"
64                 RETVAL=$1
65         fi
66 }
67
68 RETVAL=0
69 # See how we were called.
70 case "$1" in
71   start)
72         start
73         ;;
74   stop)
75         stop
76         ;;
77   restart)
78         stop
79         start
80         ;;
81   try-restart)
82         condrestart 0
83         ;;
84   force-reload)
85         condrestart 7
86         ;;
87   status)
88         status snmptrapd
89         exit $?
90         ;;
91   *)
92         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
93         exit 3
94 esac
95
96 exit $RETVAL
This page took 0.036622 seconds and 3 git commands to generate.