Subject: Re: NetBSD master CVS tree commits
To: None <tech-pkg@NetBSD.ORG>
From: Simon J. Gerraty <sjg@quick.com.au>
List: tech-pkg
Date: 07/26/1998 14:02:57
Tim Rightnour <root@garbled.net> wrote:
>We either make the pkg interactive, and say "do you want to do this" or tell
>them, "run this to do this" then:
>add apache to /etc/rc.local

I asume that anything that frobs /etc/rc.local, also has the appropriate 
magic to undo the damage if requested?  

The only addition I normally make to /etc/rc.local (or /etc/rc2.d) is to 
have it run /etc/rc_local at the end (/etc/rc_local -> /etc/rc.sh) so 
that any start scripts in /etc/rc_local.d get run.

Then adding/removing services is a simple matter of adding/removing symlinks
from /etc/rc_local.d - and you always have the start/stop script handy in 
/etc/rc_d.

I use the "odd" names to ensure that there is no conflict with vendor stuff
as I use the exact same setup on all sorts of machines other than NetBSD.

Regardless of the religious debate over wether individual start/stop scripts
would benefit NetBSD as a whole, I suspect the pkg stuff could benefit 
greatly from the above.

Upgrading pkgs would not need a re-edit of rc.local, just update the 
start/stop script in /etc/pkg.d.

At the very least it would mean that to address Tim's concern, 
the only question a user would need to answer would be if they want the 
service started automagically at boot.  If no, simply omit the symlink 
in rc_local.d (or rc_pkg.d if you like), or create it as say s45foo if 
you want to document the normal startup order - incase it matters.  The
if the user later changes their mind they can rename s45foo to S45foo.

An alternative would be to have another target in the start/stop script to
enable/dissable autostart.

Many of my current start/stop scripts include restart and check targets 
which is handy for important daemons like sendmail, named, ntp etc.
Simply adding a symlink in /etc/hourly.d like S10check_{ntp,pppd,...}
helps ensure that they are running.

If anyone wants to have a look, rc.sh and a few useful start/stop scripts 
are included in my configs tool 
(see http://www.quick.com.au/FreeWare/configs.html)


--sjg