diff options
author | peter <peter@FreeBSD.org> | 2013-08-19 04:56:03 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2013-08-19 04:56:03 +0000 |
commit | d80ee1955bb81944081da04233926bb470fb14fb (patch) | |
tree | 2504d71fc5f55b8e5e1897d83b0a5f3800dfe408 /etc/rc.d/bsnmpd | |
parent | d04910fca02621bee194fb768af6f89c53d02878 (diff) | |
download | FreeBSD-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/rc.d/bsnmpd')
-rwxr-xr-x | etc/rc.d/bsnmpd | 12 |
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" |