svn commit: r254508 - head/etc/rc.d

Peter Wemm peter at FreeBSD.org
Mon Aug 19 04:56:04 UTC 2013


Author: peter
Date: Mon Aug 19 04:56:03 2013
New Revision: 254508
URL: http://svnweb.freebsd.org/changeset/base/254508

Log:
  Add the optional ability to run as a different user.
  
  Obtained from:	Antique freebsd.org cluster archive images

Modified:
  head/etc/rc.d/bsnmpd

Modified: head/etc/rc.d/bsnmpd
==============================================================================
--- head/etc/rc.d/bsnmpd	Mon Aug 19 01:29:13 2013	(r254507)
+++ head/etc/rc.d/bsnmpd	Mon Aug 19 04:56:03 2013	(r254508)
@@ -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"


More information about the svn-src-head mailing list