ports/92755: Add ability to run slon as a different user

Jim C. Nasby decibel at decibel.org
Fri Feb 3 02:30:04 UTC 2006


>Number:         92755
>Category:       ports
>Synopsis:       Add ability to run slon as a different user
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 03 02:30:02 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Jim C. Nasby
>Release:        FreeBSD 6.0-RELEASE amd64
>Organization:
>Environment:
System: FreeBSD noel.decibel.org 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Wed Nov 2 19:07:38 UTC 2005 root at rat.samsco.home:/usr/obj/usr/src/sys/GENERIC amd64



--- files/slon.sh.in.org	Thu Feb  2 18:19:19 2006
+++ files/slon.sh.in	Thu Feb  2 19:51:57 2006
@@ -18,13 +18,30 @@
 name="%%NAME%%"
 rcvar=`set_rcvar`
 
+slon_user=${slon_user:-"root"}
 pidfile="/var/run/$name.pid"
 command="%%PREFIX%%/bin/slon"
 command_args="-f %%PREFIX%%/etc/$name.conf -p $pidfile &"
 required_files="%%PREFIX%%/etc/$name.conf"
 
+start_cmd="slon_command start"
+start_precmd="check_pid"
+
 # read configuration and set defaults
 load_rc_config "$name"
 : ${%%NAME%%_enable="NO"}
+
+slon_command()
+{
+    su -l ${slon_user} -c "exec ${command} ${command_args}"
+}
+
+check_pid()
+{
+    if ! su -l ${slon_user} -c "[ -w $pidfile ]"; then
+        touch $pidfile
+        chown ${slon_user} $pidfile
+    fi
+}
 
 run_rc_command "$1"
>Description:
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list