X-Git-Url: https://git.pld-linux.org/?a=blobdiff_plain;f=net-snmpd.init;h=f69e3ad2f2586e240c8b64cc491a7b2d987cb478;hb=refs%2Ftags%2Fauto%2Fth%2Fnet-snmp-5.7.3-7;hp=dcd4f820973c94d8ee76535ce64fdf1eaf13b9a7;hpb=eccc84ec7b468f5f72c24d30f64694d6d8525646;p=packages%2Fnet-snmp.git diff --git a/net-snmpd.init b/net-snmpd.init old mode 100644 new mode 100755 index dcd4f82..f69e3ad --- a/net-snmpd.init +++ b/net-snmpd.init @@ -5,24 +5,26 @@ # chkconfig: 345 50 50 # # description: Simple Network Management Protocol (SNMP) Daemon -# description(es): Servidor SNMP (Simple Network Management Protocol) -# description(pt_BR): Servidor SNMP (Simple Network Management Protocol) -# description(ru): äĹÍĎÎ SNMP (Simple Network Management Protocol) -# description(uk): äĹÍĎÎ SNMP (Simple Network Management Protocol) +# description(es.UTF-8): Servidor SNMP (Simple Network Management Protocol) +# description(pt_BR.UTF-8): Servidor SNMP (Simple Network Management Protocol) +# description(ru.UTF-8): Демон SNMP (Simple Network Management Protocol) +# description(uk.UTF-8): Демон SNMP (Simple Network Management Protocol) # # processname: snmpd # config: /etc/snmp/snmpd.local.conf # config: /etc/snmp/snmpd.conf - # Source function library . /etc/rc.d/init.d/functions +upstart_controlled + # Get network config . /etc/sysconfig/network CONF_FILE="" LOG_WARNINGS_MESSAGES_TO_SYSLOG="yes" +SNMPD_LISTEN_ADDRS="" # Get service config [ -f /etc/sysconfig/snmpd ] && . /etc/sysconfig/snmpd @@ -37,43 +39,75 @@ else exit 0 fi +start() { + # Check if the service is already running? + if [ -f /var/lock/subsys/snmpd ]; then + msg_already_running "snmpd" + return + fi + + msg_starting "snmpd" + daemon /usr/bin/setsid /usr/sbin/snmpd \ + $([ -n "$CONF_FILE" ] && echo "-C -c $CONF_FILE") \ + $([ -n "$SNMPD_INITLIST" ] && echo "-I \"$SNMPD_INITLIST\"") \ + $(is_yes "$LOG_WARNINGS_MESSAGES_TO_SYSLOG" && echo "-LS0-4d" ) \ + -p /var/run/snmpd.pid $SNMPD_LISTEN_ADDRS /dev/null 2>&1 +} + +condrestart() { + if [ ! -f /var/lock/subsys/snmpd ]; then + msg_not_running "snmpd" + RETVAL=$1 + return + fi + + stop + start +} + RETVAL=0 # See how we were called. case "$1" in start) - # Check if the service is already running? - if [ ! -f /var/lock/subsys/snmpd ]; then - msg_starting "snmpd" - daemon /usr/bin/setsid /usr/sbin/snmpd \ - $([ -n "$CONF_FILE" ] && echo "-C -c $CONF_FILE") \ - $( is_yes "$LOG_WARNINGS_MESSAGES_TO_SYSLOG" && \ - echo "-Lsd" ) /dev/null 2>&1 + msg_reloading "snmpd" + killproc snmpd -HUP else msg_not_running "snmpd" - fi - ;; - restart|force-reload) - $0 stop - $0 start - exit $? + fi ;; status) status snmpd exit $? ;; *) - msg_usage "$0 {start|stop|restart|force-reload|status}" + msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}" exit 3 esac