Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 07 Sep 2014 18:00:24 +0100
From:      Mike Clarke <jmc-freebsd2@milibyte.co.uk>
To:        freebsd-ports@freebsd.org
Subject:   Re: service doen't get started at boottime, but can start manually
Message-ID:  <6382694.vtzGnnjiph@curlew.lan>
In-Reply-To: <CACdU%2Bf_1umi_f8=BqUbeUSXkjRfNxbfOHY_b0aQthJnjtFp9bQ@mail.gmail.com>
References:  <20140907090321.12bbc428.ohartman@zedat.fu-berlin.de> <3855474.cM0CkAr3yg@curlew.lan> <CACdU%2Bf_1umi_f8=BqUbeUSXkjRfNxbfOHY_b0aQthJnjtFp9bQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sunday 07 Sep 2014 09:53:51 Scot Hetzel wrote:

> The scripts in 3-6, and 8 are wrong.  According to /etc/rc.subr, the
> '# PROVIDE: ' is mandatory to detect a rc script:

Well it appears that they are only half wrong.

Scripts without PROVIDE will work if they're in /etc/rc.d but not if 
in /usr/local/etc/rc.d. I have run a test case to confirm this.

In /etc/rc we have:

 95 # Do a first pass to get everything up to $early_late_divider so 
that
 96 # we can do a second pass that includes $local_startup directories
 97 #
 98 files=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* 2>/dev/null`
 99
100 _rc_elem_done=' '
101 for _rc_elem in ${files}; do
102         run_rc_script ${_rc_elem} ${_boot}
103         _rc_elem_done="${_rc_elem_done}${_rc_elem} "
104
105         case "$_rc_elem" in
106         */${early_late_divider})        break ;;
107         esac
108 done
109
110 unset files local_rc
111
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
119
120 # The firstboot sentinel might be on a newly mounted filesystem; 
look for it
121 # again and unset skip_firstboot if we find it.
122 if [ -e ${firstboot_sentinel} ]; then
123         skip_firstboot=""
124 fi
125
126 files=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* ${local_rc} 
2>/dev/null`
127 for _rc_elem in ${files}; do
128         case "$_rc_elem_done" in
129         *" $_rc_elem "*)        continue ;;
130         esac
131
132         run_rc_script ${_rc_elem} ${_boot}
133 done

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?

-- 
Mike Clarke



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6382694.vtzGnnjiph>