From owner-freebsd-questions@FreeBSD.ORG Mon Mar 26 03:46:36 2007 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 E37B016A406 for ; Mon, 26 Mar 2007 03:46:36 +0000 (UTC) (envelope-from kruptos@mlinux.org) Received: from ms-smtp-02.tampabay.rr.com (ms-smtp-02.tampabay.rr.com [65.32.5.132]) by mx1.freebsd.org (Postfix) with ESMTP id A797413C48A for ; Mon, 26 Mar 2007 03:46:36 +0000 (UTC) (envelope-from kruptos@mlinux.org) Received: from fnord.quux.edu (189.46.33.65.cfl.res.rr.com [65.33.46.189]) by ms-smtp-02.tampabay.rr.com (8.13.6/8.13.6) with ESMTP id l2Q33f3t012401; Sun, 25 Mar 2007 23:03:42 -0400 (EDT) From: Kevin Brunelle To: freebsd-questions@freebsd.org Date: Sun, 25 Mar 2007 23:03:38 -0400 User-Agent: KMail/1.9.6 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200703252303.39002.kruptos@mlinux.org> X-Virus-Scanned: Symantec AntiVirus Scan Engine Cc: Jack Stone Subject: Re: rc.d scripts 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: Mon, 26 Mar 2007 03:46:37 -0000 > >Does anyone know how to make a script in /etc/rc.d run last? For instance > >I want dhclient to be the last script in /etc/rc.d/ to run. Any help is > >much appreciated. > > This may have already been answered by others, but I believe just rename > the script with a prefix of "z" for example: "zmyscript.sh" or "zzmyscript" > to make it very last beyond the first one with a "z". > > It works for me. I have my suspicions regarding this working as you describe. As the order isn't related to the filename but to the REQUIRE tags inside the file. It is actually a non-trivial thing to make something run last. It seems like it should be easy but the system doesn't work that way. For example, adding a requirement for bgfsck (which was also last on my system when I did this) moved bgfsck down the list... and still left dhclient 4th from last. In fact, it took the addition of: # REQUIRE: bgfsck bsnmpd bridge bluetooth to actually make it the last thing run. And that is not a sure thing either... as soon as the system is updated it is likely to change. You could edit /etc/rc and add a skip for dhclient (to prevent it from being run) and then a couple lines to get just it (with rcorder -k) at the very end of /etc/rc to execute it at the very end. You would need to add a keyword declaration in /etc/rc.d/dhclient It's extremely non-standard but if absolutely required, it would work. Or there probably are other ways. Still, the exact order of scripts [under the current system] is not meant to be fixed and static. It is meant to be flexible so things can be added and removed without worry. -Kevin