On Tue, Jun 9, 2009 at 6:09 PM, patrick keshishian<pkesh...@gmail.com> wrote:
> On Tue, Jun 9, 2009 at 11:06 AM, (private) HKS<hks.priv...@gmail.com> wrote:
>> When my scripts install a package, they have to edit the monolithic
>> /etc/rc.local in order to enable starting (rc.conf.local too, but
>> that's a single line easily done with sed and checked with grep).
>> Uninstalling a package is scarier since they're removing the parts of
>> /etc/rc.local. Both of these rely on multi-line pattern matching and
>> merging, which are imperfect sciences that wrack my nerves when they
>> run automatically.
>>
>> The much larger problem, though, is with starting/stopping/restarting
>> services. Say I add spamd as an enabled service on host1. For my
>> scripts to start it properly, I have to replicate the code already in
>> /etc/rc defining how spamd starts. This is prone to errors and runs
>> the risk of breaking on upgrades. Restarting services that need more
>> than a HUP is also a chore. As for stopping, some services like
>> postgresql need some careful attention. This means replicating code
>> from /etc/rc.shutdown.
>
> for ports you add to your system (such as postgresql) you can always
> use an external script for its start/stop and just add appropriate
> section to rc.local and rc.shutdown:
>
> --- e.g., ---
> rc.local
> # ....
> if [ -x /etc/rc.pgsql ] ; then /etc/rc.pgsql start ; fi
>
> rc.shutdown
> # ...
> if [ -x /etc/rc.pgsql ] ; then /etc/rc.pgsql stop ; fi
>
> next you need to write rc.pgsql that starts or stops postgresql based
> on "$1" == "start" or == "stop"
>
> That should solve at least part of your problem.
>
> As for spamd enabling/disabling, just reboot that machine if you don't
> want to look through the rc script to figure out what you need run.
>
> --patrick
>

Thanks to all for the suggestions.

Right now the most convincing is the daemon tools suggestion - I'll
dig into that and see if it suits my needs.

I've resisted hacking rc.d and rcorder into my system mainly because I
want to avoid recoding rc just to make a few things easier. There's a
lot in OpenBSD's rc that doesn't translate directly into the rc.d type
system, so it's not going to be a simple matter. That's a lot of work
to avoid a lot of work, and I'm not sure which one really requires
more.

The other rc mods are interesting, and I'll look at using them if
daemon tools doesn't do what I'm hoping.

Thanks for the help.

-HKS

Reply via email to