]> git.pld-linux.org Git - packages/net-snmp.git/blame - net-snmpd.init
initial
[packages/net-snmp.git] / net-snmpd.init
CommitLineData
43f17c64
AF
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
24CONF_FILE=/etc/snmp/snmpd.conf
25LOG_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.
31if is_no "${NETWORKING}"; then
32 msg_network_down "snmpd"
33 exit 1
34fi
35
36# See how we were called.
37case "$1" in
38 start)
39 # Check if the service is already running?
40 if [ ! -f /var/lock/subsys/snmpd ]; then
41 msg_starting "snmpd"
42 daemon /usr/bin/setsid /usr/sbin/snmpd \
43 $([ -n "$CONF_FILE" ] && echo "-C -c $CONF_FILE") \
44 $( is_yes "$LOG_WARNINGS_MESSAGES_TO_SYSLOG" && \
45 echo "-s" ) </dev/null
46 RETVAL=$?
47 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmpd
48 else
49 msg_already_running "snmpd"
50 RETVAL=1
51 fi
52 ;;
53 stop)
54 if [ -f /var/lock/subsys/snmpd ]; then
55 msg_stopping "snmpd"
56 killproc snmpd
57 rm -f /var/lock/subsys/snmpd >/dev/null 2>&1
58 else
59 msg_not_running "snmpd"
60 RETVAL=1
61 fi
62 ;;
63 restart|reload)
64 $0 stop
65 $0 start
66 ;;
67 status)
68 status snmpd
69 exit $?
70 ;;
71 *)
72 msg_usage "$0 {start|stop|status|restart|reload}"
73 RETVAL=1
74esac
75
76exit $RETVAL
This page took 0.08445 seconds and 4 git commands to generate.