From owner-freebsd-rc@FreeBSD.ORG Sun Dec 20 20:10:52 2009 Return-Path: Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B98F1065693 for ; Sun, 20 Dec 2009 20:10:52 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id C19A18FC14 for ; Sun, 20 Dec 2009 20:10:51 +0000 (UTC) Received: (qmail 24714 invoked by uid 399); 20 Dec 2009 20:10:50 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 20 Dec 2009 20:10:50 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4B2E84CF.2060902@FreeBSD.org> Date: Sun, 20 Dec 2009 12:10:55 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Thunderbird 2.0.0.23 (X11/20091206) MIME-Version: 1.0 To: Hajimu UMEMOTO References: <200912200134.nBK1YCAA048942@svn.freebsd.org> <4B2DBB51.9060002@FreeBSD.org> <4B2DD2A1.8060907@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 0.96.0 OpenPGP: id=D5B2F0FB Content-Type: multipart/mixed; boundary="------------060103070006030401020109" Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, freebsd-rc@FreeBSD.org Subject: Re: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 20:10:52 -0000 This is a multi-part message in MIME format. --------------060103070006030401020109 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hajimu UMEMOTO wrote: > Yup, I often do restart the services installed from ports, too. > I meant that I don't want that the values of user environment are > inherited to the services which is started from the user environment. And I meant that I see the ability to start services AND inherit the user environment as a feature, however the people have spoken! :) I agree to making the change you suggested, but I would like to quibble over the format. Isn't the attached patch equivalent, and simpler? What is the value of setting HOME and PATH in the environment if we're just going to use 'env -i HOME PATH' anyway? Doug -- Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ --------------060103070006030401020109 Content-Type: text/plain; name="service-env.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="service-env.diff" Index: service.8 =================================================================== --- service.8 (revision 200757) +++ service.8 (working copy) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 19, 2009 +.Dd December 20, 2009 .Dt service 8 .Os .Sh NAME @@ -44,7 +44,10 @@ .Nm command is an easy interface to the rc.d system. Its primary purpose is to start and stop services provided -by the rc.d scripts, however it can also be used to list +by the rc.d scripts. +When used for this purpose it will set the same restricted +environment that is in use at boot time (see below). +It can also be used to list the scripts using various criteria. .Pp The options are as follows: @@ -78,6 +81,20 @@ .It Fl v Be slightly more verbose .El +.Sh ENVIRONMENT +When used to run rc.d scripts the +.Nm +command sets +.Ev HOME +to +.Pa / +and +.Ev PATH +to +.Pa /sbin:/bin:/usr/sbin:/usr/bin +which is how they are set in +.Pa /etc/rc +at boot time. .Sh EXIT STATUS .Ex -std .Sh EXAMPLES Index: service.sh =================================================================== --- service.sh (revision 200757) +++ service.sh (working copy) @@ -106,11 +106,11 @@ exit 1 fi +cd / for dir in /etc/rc.d $local_startup; do if [ -x "$dir/$script" ]; then [ -n "$VERBOSE" ] && echo "$script is located in $dir" - $dir/$script $* - exit $? + exec env -i HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin $dir/$script $* fi done --------------060103070006030401020109--