Subject: Re: /etc/init.d/* and /etc/rc* (was: NetBSD master CVS tree commits)
To: None <greywolf@defender.VAS.viewlogic.com>
From: Simon J. Gerraty <sjg@zen.void.oz.au>
List: current-users
Date: 04/02/1996 22:10:11
>In short what we'd end up with is:
> init.d -> rc.d/ init script directory - ADD
Sadly that won't please anyone. If you are going to pretend to
accomodate the pgk_add crowd then do it right.
/etc/init.d is a place for files with names like x25,nfs etc.
/etc/rc*.d is a place for files with names like S20nfs which are
typically though not necessarily symlinks to ../init.d/*
The first is simply a convenient holding area for start/stop scripts
which may or may not be currently in use. The 2nd is a directory to
actualy implement the selected start scripts in a selected order.
> rc.local would run
> if [ -d /etc/rc.d ]; then
> (cd /etc/rc.d
> for file in S*; do
> sh $file start; done); fi
Again, if you are going to do it...
for f in S*
do
test -d $f && continue
test -s $f || continue # avoid symlinks to nothing
case $f in
*[*~]|*.old|*.bak) ;; # skip it
*.sh) # source it
. $f
;;
*) # run it
sh $f start
;;
esac
done
The sourcing of .sh files is very important to the flexibility of the
model.
>Comments? I mean, I'm sure some of you will say "what an idiot(ic pro-
>posal)!", but still: Comments?
I think I've pointed out before that I do pretty well what you suggest
on just about all my systems. Ie. On SunOS the end of /etc/rc.local
conatins:
#
# Local additions, add them to /etc/rc_local.d
#
if [ -x /etc/rc_local.sh ]; then
/etc/rc_local.sh
fi
where /etc/rc_local.sh is just a link to a generic rc.sh and processes
/etc/rc_local.d in the appropriate manner (if the directory exists)
on HP-UX it is at the end of /etc/rc,
on Solaris its simply /etc/rc2.d/S99rc_local
ie. different hooks on each system but the net result is that all the
local additions my local startup dir take place.
Of course you can argue about the choice of name...
--sjg