Re: where are /usr/local/etc/rc.d init scripts run from?
On 12/23/06, Kevin Brunelle <[EMAIL PROTECTED]> wrote: 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. I should have mentioned that I'm running 5.4. I suspect you're talking about 6.X code, as some of what you're mentioning, I don't see on my system. Something to look forward to when I upgrade then. Thanks for the detail explanation. Mike -- Michael P. Soulier <[EMAIL PROTECTED]> "Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction." --Albert Einstein ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: where are /usr/local/etc/rc.d init scripts run from?
> 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 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: where are /usr/local/etc/rc.d init scripts run from?
On 12/23/06, Kevin Brunelle <[EMAIL PROTECTED]> wrote: 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). Ok, looking in localpkg, I see this. pkg_start() { # For each dir in $local_startup, search for init scripts matching *.sh # case ${local_startup} in [Nn][Oo] | '') ;; *) echo -n 'Local package initialization:' slist="" if [ -z "${script_name_sep}" ]; then script_name_sep=" " fi for dir in ${local_startup}; do if [ -d "${dir}" ]; then for script in ${dir}/*.sh; do slist="${slist}${script_name_sep}${script}" done fi done script_save_sep="$IFS" IFS="${script_name_sep}" for script in ${slist}; do if [ -x "${script}" ]; then (set -T trap 'exit 1' 2 ${script} start) elif [ -f "${script}" -o -L "${script}" ]; then echo -n " (skipping ${script##*/}, not executable)" fi done IFS="${script_save_sep}" echo '.' ;; esac } 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. 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. Ok, thanks. Mike -- Michael P. Soulier <[EMAIL PROTECTED]> "Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction." --Albert Einstein ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: where are /usr/local/etc/rc.d init scripts run from?
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 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: where are /usr/local/etc/rc.d init scripts run from?
On 12/24/06, Michael P. Soulier <[EMAIL PROTECTED]> 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/*? 1. grep for rcorder in rc 2. grep for local_rc in rc.subr ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
where are /usr/local/etc/rc.d init scripts run from?
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 -- Michael P. Soulier <[EMAIL PROTECTED]> "Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction." --Albert Einstein ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"