Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Dec 2009 13:50:55 +0900
From:      Hajimu UMEMOTO <ume@FreeBSD.org>
To:        Doug Barton <dougb@FreeBSD.org>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r200743 - in head/usr.sbin: . service
Message-ID:  <yged42ackpc.wl%ume@mahoroba.org>
In-Reply-To: <200912200134.nBK1YCAA048942@svn.freebsd.org>
References:  <200912200134.nBK1YCAA048942@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--Multipart_Sun_Dec_20_13:50:55_2009-1
Content-Type: text/plain; charset=US-ASCII

Hi,

>>>>> On Sun, 20 Dec 2009 01:34:12 +0000 (UTC)
>>>>> Doug Barton <dougb@FreeBSD.org> said:

dougb> Author: dougb
dougb> Date: Sun Dec 20 01:34:12 2009
dougb> New Revision: 200743
dougb> URL: http://svn.freebsd.org/changeset/base/200743

dougb> Log:
dougb>   The service command is an easy interface to the rc.d system.
dougb>   Its primary purpose is to start and stop services provided by
dougb>   the rc.d scripts, however it can also be used to list the scripts
dougb>   using various criteria.

dougb> Added:
dougb>   head/usr.sbin/service/
dougb>   head/usr.sbin/service/Makefile   (contents, props changed)
dougb>   head/usr.sbin/service/service.8   (contents, props changed)
dougb>   head/usr.sbin/service/service.sh   (contents, props changed)
dougb> Modified:
dougb>   head/usr.sbin/Makefile

I believe this addition is useful.  I'm using similar script locally.
However, we should consider the environment variables and the current
directory, IMO.  Could you include the attached patch?

Sincerely,

--Multipart_Sun_Dec_20_13:50:55_2009-1
Content-Type: text/x-patch; type=patch; charset=US-ASCII
Content-Disposition: attachment; filename="service-env.diff"
Content-Transfer-Encoding: 7bit

Index: usr.sbin/service/service.sh
diff -u usr.sbin/service/service.sh.orig usr.sbin/service/service.sh
--- usr.sbin/service/service.sh.orig	2009-12-20 13:14:14.000000000 +0900
+++ usr.sbin/service/service.sh	2009-12-20 13:17:44.420246627 +0900
@@ -106,11 +106,15 @@
 	exit 1
 fi
 
+HOME=/
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+export HOME PATH
+cd $HOME
+
 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=$HOME PATH=$PATH $dir/$script $*
 	fi
 done
 

--Multipart_Sun_Dec_20_13:50:55_2009-1
Content-Type: text/plain; charset=US-ASCII


--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume@mahoroba.org  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/

--Multipart_Sun_Dec_20_13:50:55_2009-1--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?yged42ackpc.wl%ume>