]> git.pld-linux.org Git - packages/net-snmp.git/blob - net-snmptrapd.init
- AC_DEFINE(NETSNMP_USE_KERBEROS_MIT) inside condition, not always (unbreaks ac build...
[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 RETVAL=0
59 # See how we were called.
60 case "$1" in
61   start)
62         start
63         ;;
64   stop)
65         stop
66         ;;
67   restart|force-reload)
68         stop
69         start
70         ;;
71   status)
72         status snmptrapd
73         exit $?
74         ;;
75   *)
76         msg_usage "$0 {start|stop|restart|force-reload|status}"
77         exit 3
78 esac
79
80 exit $RETVAL
This page took 0.09063 seconds and 3 git commands to generate.