From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Feb 3 02:30:03 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CB97516A420 for ; Fri, 3 Feb 2006 02:30:03 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2723843D48 for ; Fri, 3 Feb 2006 02:30:03 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k132U2Ss028741 for ; Fri, 3 Feb 2006 02:30:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k132U2pu028739; Fri, 3 Feb 2006 02:30:02 GMT (envelope-from gnats) Resent-Date: Fri, 3 Feb 2006 02:30:02 GMT Resent-Message-Id: <200602030230.k132U2pu028739@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Jim C. Nasby" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A211016A420 for ; Fri, 3 Feb 2006 02:22:49 +0000 (GMT) (envelope-from decibel@decibel.org) Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4D1EC43D48 for ; Fri, 3 Feb 2006 02:22:49 +0000 (GMT) (envelope-from decibel@decibel.org) Received: by noel.decibel.org (Postfix, from userid 1001) id E2C0739846; Thu, 2 Feb 2006 20:22:38 -0600 (CST) Message-Id: <20060203022238.E2C0739846@noel.decibel.org> Date: Thu, 2 Feb 2006 20:22:38 -0600 (CST) From: "Jim C. Nasby" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/92755: Add ability to run slon as a different user X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "Jim C. Nasby" List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2006 02:30:04 -0000 >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: