Skip site navigation (1)Skip section navigation (2)
Date:      Thu,  2 Feb 2006 20:22:38 -0600 (CST)
From:      "Jim C. Nasby" <decibel@decibel.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/92755: Add ability to run slon as a different user
Message-ID:  <20060203022238.E2C0739846@noel.decibel.org>
Resent-Message-ID: <200602030230.k132U2pu028739@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



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