Skip to content
Snippets Groups Projects
Commit 5c26a28b authored by Adam Wujek's avatar Adam Wujek :speech_balloon:
Browse files

rootfs: improve snmpd's init script


Use start-stop-daemon to start/stop snmpd daemon.
Change name of init script from snmp to snmpd. Also rename link from S80snmp to
S80snmpd. Rename and update snmpd config for monit.

Distinguish between start-stop-daemon return value 0, 1 and the rest.

Signed-off-by: default avatarAdam Wujek <adam.wujek@cern.ch>
parent 4f5ce6d4
No related merge requests found
......@@ -16,18 +16,31 @@ start_counter() {
}
start() {
echo -n "Starting snmpd daemon: "
# Log to syslog at daemon level. And log source address (-a)
snmpd -Lsd -p $SNMP_PID -a -c $SNMP_CONF
start_counter
start-stop-daemon -q -p $SNMP_PID -S \
--exec /usr/sbin/snmpd -- -Lsd -p $SNMP_PID -a -c $SNMP_CONF
ret=$?
if [ $ret -eq 0 ]; then
start_counter
echo "OK"
elif [ $ret -eq 1 ]; then
echo "Failed (already running?)"
else
echo "Failed"
fi
}
stop() {
if pidof snmpd > /dev/null; then
echo -n "Stopping snmpd: "
start-stop-daemon -K -q -p $SNMP_PID
echo -n "Stopping snmpd: "
start-stop-daemon -K -q -p $SNMP_PID
if [ $? -eq 0 ]; then
echo "OK"
else
echo "Failed"
fi
}
restart() {
stop
start
......
check process snmpd with pidfile /var/run/snmpd.pid
start program = "/etc/init.d/snmp start"
stop program = "/etc/init.d/snmp stop"
start program = "/etc/init.d/snmpd start"
stop program = "/etc/init.d/snmpd stop"
if 5 restart within 10 cycles then exec "/sbin/reboot"
../init.d/snmp
\ No newline at end of file
../init.d/snmpd
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment