Re: Scripts for /etc/init.d or /etc/rc.d

Jonathan Hogg <[email protected]> Wed, 14 May 2003 08:14:49 +0100
Newsgroups gmane.comp.sysutils.ark.devel
Organization One Good Idea Ltd.
Message-ID <BAE7AB79.1B1AC%[email protected]>
On 14/5/03 5:36, Joel Shprentz wrote:

> Packages like apache, flexlm, and ssh install servers that should start at
> system boot time.  I don't see any support in Sidai for installing scripts
> in /etc/init.d, /etc/rc.d, etc.
> 
> I did see Sidai packages like hp-rc.d-config and
> solaris-rc.d-config.  These modify or replace some standard startup
> scripts, but don't handle the server application startup scripts.
> 
> Will described his vision for rc.d scripts in "Higher-order (and
> first-order) packages"
> <http://ark.sourceforge.net/pkg-mgmt.html#pkg-orders>, but I haven't found
> any implementation yet.
> 
> Am I missing the obvious again? :-)

Personally, I usually just have a prototype for Things That Should Start At
Boot and <start/> and <stop/> methods. Then I have a single script in my
/etc/rc.d (or whatever) that does something like:

    /ark/bin/ark package start --host=. boot-services

This works well enough in most cases. It also allows you to use ark to do
cool things like:

    /ark/bin/ark package reload --host=ALL apache--2.0

The main warning I'd have about this is that ark aborts if a step fails and
in one case I had something like the web server fail at boot returning an
error code, this aborted the startup process before sshd had been started
and made the machine inaccessible -- a bit of a pain when the machine was a
few hundred miles away :-(

So I'd recommend guarding against this sort of thing with something like:

    $SERVER $OPTS >/tmp/log.$pkgname 2>&1 || \
      { mail -s "$pkgname failed on $HOST" admins < /tmp/log.$pkgname ; \
        exit 0 ; }

Jonathan



-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com