From owner-freebsd-questions@FreeBSD.ORG Sun Dec 24 03:41:22 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 502F916A415 for ; Sun, 24 Dec 2006 03:41:22 +0000 (UTC) (envelope-from kruptos@mlinux.org) Received: from ms-smtp-03.tampabay.rr.com (ms-smtp-03.tampabay.rr.com [65.32.5.133]) by mx1.freebsd.org (Postfix) with ESMTP id 02E5613C45E for ; Sun, 24 Dec 2006 03:41:21 +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-03.tampabay.rr.com (8.13.6/8.13.6) with ESMTP id kBO3fCnN021100; Sat, 23 Dec 2006 22:41:14 -0500 (EST) From: Kevin Brunelle To: freebsd-questions@freebsd.org Date: Sat, 23 Dec 2006 22:41:08 -0500 User-Agent: KMail/1.9.5 References: <200612231852.56016.kruptos@mlinux.org> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200612232241.09284.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 03:41:22 -0000 > So rcorder is not used for the rc scripts in /usr/local/etc/rc.d? That > explains much, since I have a runsvstat.sh script needed to start > runit, and a script to start one of its services starts with an 'm' > and is executing first, which I don't want. > > Why is rcorder not used on these files as well? It's such a good system. I was unintentionally confusing in my answer. Sorry about that. If your startup script is in the old style, it will be handled by /etc/rc.d/localpkg when that is called during the boot process. That is ONLY if it's the old style. If it is part of the new style, it will be sorted *correctly* by rcorder with the other scripts in /etc/rc.d/. I have to highlight correctly because for your script to actually be handled correctly it must appear in the order after the $early_late_divider (which is probably mountcritical but could be NETWORKING if you're running a jail or something else if it's redefined by your environment). Typically, as long as your script appears after mountcritical, it will be handled correctly. If you read /etc/rc carefully, you will see that rcorder is run twice. The first time with just the scripts in /etc/rc.d/ and then it starts processing those. This is the bit of code you included. But, if you look, it breaks that look at the $early_late_divider and then goes down to the block I pointed out (starting on line 98 in my system). In this case it finds all the "new style" scripts in the ${local_startup} directories and then uses rcorder to resort all the scripts in /etc/rc.d/ with the new style scripts from those directories. Then code then loops again (this time ignoring scripts) until it hits the $early_late_divider and then runs all the scripts after that. If your script appears earlier than that, it will be sorted into the section of scripts which won't be run. In practice, this should not be a problem. If your script is not being run correctly... you need to investigate /etc/rc.subr and try and understand why it is not seeing it as a "new style" script or if some other mistake is being made. find_local_scripts_new is the function that does this (line 1392 on my system) and is where I would look. I hope this is a little more clear. -Kevin