freebsd-nq/etc/rc.d/bsnmpd
Peter Wemm 25180adf0d Add the optional ability to run as a different user.
Obtained from:	Antique freebsd.org cluster archive images
2013-08-19 04:56:03 +00:00

29 lines
468 B
Bash
Executable File

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: bsnmpd
# REQUIRE: NETWORKING syslogd
# KEYWORD: nojail shutdown
. /etc/rc.subr
name="bsnmpd"
rcvar="bsnmpd_enable"
command="/usr/sbin/${name}"
start_cmd="bsnmpd_start"
bsnmpd_start()
{
rc_flags="-p ${pidfile} ${bsnmpd_flags}"
echo -n "Starting bsnmpd"
su -m $user -c "$command ${rc_flags}"
echo "."
}
load_rc_config $name
user="${bsnmpd_username:-root}"
pidfile="${bsnmpd_pidfile:-/var/run/snmpd.pid}"
run_rc_command "$1"