Date: Mon, 08 Sep 2014 09:47:07 +0200 From: Stefan Esser <se@freebsd.org> To: Mike Clarke <jmc-freebsd2@milibyte.co.uk>, freebsd-ports@freebsd.org Subject: Re: service doen't get started at boottime, but can start manually Message-ID: <540D5EFB.50402@freebsd.org> In-Reply-To: <6382694.vtzGnnjiph@curlew.lan> References: <20140907090321.12bbc428.ohartman@zedat.fu-berlin.de> <3855474.cM0CkAr3yg@curlew.lan> <CACdU%2Bf_1umi_f8=BqUbeUSXkjRfNxbfOHY_b0aQthJnjtFp9bQ@mail.gmail.com> <6382694.vtzGnnjiph@curlew.lan>
next in thread | previous in thread | raw e-mail | index | archive | help
Am 07.09.2014 um 19:00 schrieb Mike Clarke: > So all files in /etc/rd.d are potential startup scripts but those in > /usr/local/etc must meet the requirement of having a PROVIDE line. > > This inconsistency isn't mentioned anywhere in the examples in > <https://www.freebsd.org/doc/en/articles/rc-scripting/index.html> so > it looks like either the documentation needs this adding or perhaps > the test for PROVIDE in find_local_scripts_new() should be replaced by > a test for defining the variable "name" (which is mandatory) or > perhaps there's no longer any need to apply this test? This was for a reason: There used to be an etc/rc.local (not sure about its name at that time) that just invoked all scripts found in /usr/local/etc/rc.d in alphabetical order, ignoring backup scripts ending in e.g. "~". Scripts where started without argument, there was no stop function and thus no way to stop a local service from a rc.d script before shutdown. (This logic is still found in "rc.d/localpkg" - it does try to perform a stop operation though, which is different from the old behaviour AFAIR. Legacy startup scripts did not check for any parameters being passed to them ...) > In /etc/rc we have: [...] > 112 # Now that disks are mounted, for each dir in $local_startup > 113 # search for init scripts that use the new rc.d semantics. > 114 # > 115 case ${local_startup} in > 116 [Nn][Oo] | '') ;; > 117 *) find_local_scripts_new ;; > 118 esac [...] (The above sets ${local_rc} > 126 files=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* ${local_rc} 2>/dev/null` When local/etc/rc.d was included into the rcorder based dependency calculation, there still were many "old" scripts. Invoking them at shutdown could lead to bad effects and they lacked the parameters required for dependency calculation. (IIRC, these used to have a ".sh" extension, but I'm not sure whether it was mandatory in order to have them executed by rc.d/local.) A simple mechanism was required to distinguish scripts that should still be started in alphabetic order and only on startup from those that had dependency information (to be sorted by rcorder and to be invoced with "stop" on shutdown). And checking for "PROVIDE:" is a simple discriminator, which selects the mechanism to use, without relying on the file name (which did not follow a strict scheme and presence or absence of ".sh" was no good indicator). This logic (and dependency on PROVIDE: for local startup files) exists as long as they have been included in the rcorder calculation. And it may still be a sensible requirement, since there might be local startup scripts that never made it into the tree or into a port, which rely on this behaviour. This is obviously a shortcoming in the documentation, which should be fixed. AFAIK, the old style startup files have never been deprecated and are still fully supported ... Regards, STefan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?540D5EFB.50402>