On Tue, Jun 9, 2009 at 11:06 AM, (private) HKS<[email protected]> 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

Reply via email to