blob: 6f7ead79f85f30fecbb82235476f6cebeebb3701 (
plain)
1 #!/bin/bash
2 #
3 # /etc/rc.d/snmpd: start/stop net-snmpd daemon
4 #
5
6 SSD=/sbin/start-stop-daemon
7 PROG=/usr/sbin/snmpd
8 PID=/var/run/snmp/snmpd.pid
9 LOG=/var/log/snmp/snmpd.log
10 OPTS="-A -p $PID -Lf $LOG -u snmp -g snmp"
11
12 case $1 in
13 start)
14 $SSD --start --pidfile $PID --exec $PROG -- $OPTS
15 ;;
16 stop)
17 $SSD --stop --remove-pidfile --retry 10 --pidfile $PID
18 ;;
19 restart)
20 $0 stop
21 $0 start
22 ;;
23 status)
24 $SSD --status --pidfile $PID
25 case $? in
26 0) echo "$PROG is running with pid $(cat $PID)" ;;
27 1) echo "$PROG is not running but the pid file $PID exists" ;;
28 3) echo "$PROG is not running" ;;
29 4) echo "Unable to determine the program status" ;;
30 esac
31 ;;
32 *)
33 echo "usage: $0 [start|stop|restart|status]"
34 ;;
35 esac
36
37 # End of file
|