summaryrefslogtreecommitdiff
path: root/net/ucd-snmp/files/snmpd.sh
blob: e1f5e82d5617a6d5bdd83a9a2c3bcfa906157c50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
# $NetBSD: snmpd.sh,v 1.6 2002/02/27 15:13:31 tron Exp $

# PID file:
PF=/var/run/snmpd.pid


if [ -f /etc/snmp/snmpd.conf ]
then
    SNMPD_CFG="-c /etc/snmp/snmpd.conf"
fi

case $1 in
start)
	if [ -x @PREFIX@/sbin/snmpd ]
	then
	    echo 'Starting snmpd.'
	    @PREFIX@/sbin/snmpd -s -P ${PF} -A ${SNMPD_CFG}
	fi
	;;
stop)
	if [ -f ${PF} ]; then
		kill `cat ${PF}`
		rm -f ${PF}
	else
		echo "$0: snmpd not running or PID not recorded!" 1>&2
	fi
	;;
restart)
	sh $0 stop
	sleep 5
	sh $0 start
	;;
*)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac