]> git.pld-linux.org Git - packages/net-snmp.git/blob - net-snmpd.init
- cleaning
[packages/net-snmp.git] / net-snmpd.init
1 #!/bin/sh
2 #
3 # snmpd                 Simple Network Management Protocol (SNMP) Daemon
4 #
5 # chkconfig:            345 50 50
6 #
7 # description:          Simple Network Management Protocol (SNMP) Daemon
8 # description(es):      Servidor SNMP (Simple Network Management Protocol)
9 # description(pt_BR):   Servidor SNMP (Simple Network Management Protocol)
10 # description(ru):      äĹÍĎΠSNMP (Simple Network Management Protocol)
11 # description(uk):      äĹÍĎΠSNMP (Simple Network Management Protocol)
12 #
13 # processname:          snmpd
14 # config:               /etc/snmp/snmpd.local.conf
15 # config:               /etc/snmp/snmpd.conf
16
17
18 # Source function library
19 . /etc/rc.d/init.d/functions
20
21 # Get network config
22 . /etc/sysconfig/network
23
24 CONF_FILE=/etc/snmp/snmpd.conf
25 LOG_WARNINGS_MESSAGES_TO_SYSLOG=yes
26
27 # Get service config
28 [ -f /etc/sysconfig/snmpd ] && . /etc/sysconfig/snmpd
29
30 # Check that networking is up.
31 if is_yes "${NETWORKING}"; then
32         if [ ! -f /var/lock/subsys/network ]; then
33                 msg_network_down "snmpd"
34                 exit 1
35         fi
36 else
37         exit 0
38 fi
39
40 # See how we were called.
41 case "$1" in
42   start)
43         # Check if the service is already running?
44         if [ ! -f /var/lock/subsys/snmpd ]; then
45                 msg_starting "snmpd"
46                 daemon /usr/bin/setsid /usr/sbin/snmpd \
47                         $([ -n "$CONF_FILE" ] && echo "-C -c $CONF_FILE") \
48                         $( is_yes "$LOG_WARNINGS_MESSAGES_TO_SYSLOG" && \
49                                 echo "-s" ) </dev/null
50                 RETVAL=$?
51                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmpd
52         else
53                 msg_already_running "snmpd"
54                 RETVAL=1
55         fi
56         ;;
57   stop)
58         if [ -f /var/lock/subsys/snmpd ]; then
59                 msg_stopping "snmpd"
60                 killproc snmpd
61                 rm -f /var/lock/subsys/snmpd >/dev/null 2>&1
62         else
63                 msg_not_running "snmpd"
64                 RETVAL=1
65         fi      
66         ;;
67   restart|reload)
68         $0 stop
69         $0 start
70         ;;
71   status)
72         status snmpd
73         exit $?
74         ;;
75   *)
76         msg_usage "$0 {start|stop|restart|reload|status}"
77         RETVAL=1
78 esac
79
80 exit $RETVAL
This page took 0.060391 seconds and 4 git commands to generate.