From owner-freebsd-questions@FreeBSD.ORG Sun Dec 24 00:52:15 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E0B8616A403 for ; Sun, 24 Dec 2006 00:52:15 +0000 (UTC) (envelope-from kruptos@mlinux.org) Received: from ms-smtp-05.tampabay.rr.com (ms-smtp-05.tampabay.rr.com [65.32.5.135]) by mx1.freebsd.org (Postfix) with ESMTP id 93DD113C442 for ; Sun, 24 Dec 2006 00:52:15 +0000 (UTC) (envelope-from kruptos@mlinux.org) Received: from fnord.quux.edu (93.39.33.65.cfl.res.rr.com [65.33.39.93]) by ms-smtp-05.tampabay.rr.com (8.13.6/8.13.6) with ESMTP id kBNNqwTN015053; Sat, 23 Dec 2006 18:52:59 -0500 (EST) From: Kevin Brunelle To: freebsd-questions@freebsd.org Date: Sat, 23 Dec 2006 18:52:55 -0500 User-Agent: KMail/1.9.5 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200612231852.56016.kruptos@mlinux.org> X-Virus-Scanned: Symantec AntiVirus Scan Engine Cc: "Michael P. Soulier" Subject: Re: where are /usr/local/etc/rc.d init scripts run from? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Dec 2006 00:52:16 -0000 On Saturday 23 December 2006 18:15, Michael P. Soulier wrote: > I was looking in /etc/rc, and it's obvious to see where the /etc/rc.d > scripts are run from. > > skip="-s nostart" > [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ] && skip="$skip -s nojail" > files=`rcorder ${skip} /etc/rc.d/* 2>/dev/null` > > for _rc_elem in ${files}; do > run_rc_script ${_rc_elem} ${_boot} > done > > So rcorder is run over /etc/rc.d/*. > > When is the same done for /usr/local/etc/rc.d/*? > > Thanks, > Mike They are called from /etc/rc.d/localpkg if they are the old style. The directories searched are defined with local_startup (which defaults to: /usr/local/etc/rc.d /usr/X11R6/etc/rc.d). The new style scripts are found in /etc/rc as well. You may want to look at the find_local_scripts_new() function in /etc/rc.subr to see how some of this functions. There is some trickery here because we have to do this in more than one step. Since /usr/local/etc/rc.d/ may not be on a mounted filesystem until we run through some of the earlier scripts. [/etc/rc:98-118] # Now that disks are mounted, for each dir in $local_startup # search for init scripts that use the new rc.d semantics. # case ${local_startup} in [Nn][Oo] | '') ;; *) find_local_scripts_new ;; esac files=`rcorder ${skip} /etc/rc.d/* ${local_rc} 2>/dev/null` _skip_early=1 for _rc_elem in ${files}; do case "$_skip_early" in 1) case "$_rc_elem" in */${early_late_divider}) _skip_early=0 ;; esac continue ;; esac run_rc_script ${_rc_elem} ${_boot} done