Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Aug 2013 04:56:04 +0000 (UTC)
From:      Peter Wemm <peter@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r254508 - head/etc/rc.d
Message-ID:  <201308190456.r7J4u4EG097606@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308190456.r7J4u4EG097606>