From owner-svn-src-stable-7@FreeBSD.ORG Wed Dec 30 19:38:57 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4C3C1065721; Wed, 30 Dec 2009 19:38:57 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B1A338FC13; Wed, 30 Dec 2009 19:38:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBUJcvdR068782; Wed, 30 Dec 2009 19:38:57 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBUJcvkn068778; Wed, 30 Dec 2009 19:38:57 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200912301938.nBUJcvkn068778@svn.freebsd.org> From: Doug Barton Date: Wed, 30 Dec 2009 19:38:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201274 - in stable/7/usr.sbin: . service X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2009 19:38:58 -0000 Author: dougb Date: Wed Dec 30 19:38:57 2009 New Revision: 201274 URL: http://svn.freebsd.org/changeset/base/201274 Log: MFC r200743: The service 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 the scripts using various criteria. MFC r200809, r200980, r201035, r201069, 201070: Updates/fixes suggested after the initial introduction Added: - copied from r200743, head/usr.sbin/service/ Directory Properties: stable/7/usr.sbin/service/ (props changed) Modified: stable/7/usr.sbin/Makefile (contents, props changed) stable/7/usr.sbin/service/service.8 stable/7/usr.sbin/service/service.sh Directory Properties: stable/7/usr.sbin/ (props changed) Modified: stable/7/usr.sbin/Makefile ============================================================================== --- stable/7/usr.sbin/Makefile Wed Dec 30 19:36:40 2009 (r201273) +++ stable/7/usr.sbin/Makefile Wed Dec 30 19:38:57 2009 (r201274) @@ -164,6 +164,7 @@ SUBDIR= ${_ac} \ ${_sa} \ ${_sade} \ ${_sendmail} \ + service \ setfib \ setfmac \ setpmac \ Modified: stable/7/usr.sbin/service/service.8 ============================================================================== --- head/usr.sbin/service/service.8 Sun Dec 20 01:34:12 2009 (r200743) +++ stable/7/usr.sbin/service/service.8 Wed Dec 30 19:38:57 2009 (r201274) @@ -24,18 +24,18 @@ .\" .\" $FreeBSD$ .\" -.Dd December 19, 2009 +.Dd December 26, 2009 .Dt service 8 .Os .Sh NAME .Nm service -.Nd "service command manual page" +.Nd "control (start/stop/etc.) or list system services" .Sh SYNOPSIS .Nm .Fl e .Nm .Op Fl v -.Fl l|r +.Fl l | r .Nm .Op Fl v .Ar start|stop|etc. @@ -44,7 +44,10 @@ The .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 @@ above, but list all of the files, not ju .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 @@ -99,8 +116,8 @@ for the names of the rc.d scripts: .Dl "}" .Dl "complete -F _service service" .Sh SEE ALSO -.Xr bash 1 , -.Xr rc.conf 5 . +.Xr bash 1 Pq Pa ports/shells/bash , +.Xr rc.conf 5 , .Xr rc 8 , .Xr rcorder 8 .Sh HISTORY Modified: stable/7/usr.sbin/service/service.sh ============================================================================== --- head/usr.sbin/service/service.sh Sun Dec 20 01:34:12 2009 (r200743) +++ stable/7/usr.sbin/service/service.sh Wed Dec 30 19:38:57 2009 (r201274) @@ -33,7 +33,7 @@ usage () { echo '' echo 'Usage:' echo "${0##*/} -e" - echo "${0##*/} [-v] -l|r" + echo "${0##*/} [-v] -l | -r" echo "${0##*/} [-v] start|stop|etc." echo "${0##*/} -h" echo '' @@ -106,11 +106,11 @@ else 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