summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2013-08-19 04:56:03 +0000
committerpeter <peter@FreeBSD.org>2013-08-19 04:56:03 +0000
commitd80ee1955bb81944081da04233926bb470fb14fb (patch)
tree2504d71fc5f55b8e5e1897d83b0a5f3800dfe408 /etc
parentd04910fca02621bee194fb768af6f89c53d02878 (diff)
downloadFreeBSD-src-d80ee1955bb81944081da04233926bb470fb14fb.zip
FreeBSD-src-d80ee1955bb81944081da04233926bb470fb14fb.tar.gz
Add the optional ability to run as a different user.
Obtained from: Antique freebsd.org cluster archive images
Diffstat (limited to 'etc')
-rwxr-xr-xetc/rc.d/bsnmpd12
1 files changed, 11 insertions, 1 deletions
diff --git a/etc/rc.d/bsnmpd b/etc/rc.d/bsnmpd
index 2aad72e..49d2d90 100755
--- a/etc/rc.d/bsnmpd
+++ b/etc/rc.d/bsnmpd
@@ -12,7 +12,17 @@
name="bsnmpd"
rcvar="bsnmpd_enable"
command="/usr/sbin/${name}"
-pidfile="/var/run/snmpd.pid"
+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"
OpenPOWER on IntegriCloud