Hi,

>>>>> On Sun, 20 Dec 2009 01:34:12 +0000 (UTC)
>>>>> Doug Barton <do...@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,
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
 
--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
u...@mahoroba.org  u...@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to