[NCLUG] Startup Scripts

Sean Reifschneider jafo at tummy.com
Tue Apr 11 03:01:06 MDT 2006


On Mon, Apr 10, 2006 at 04:25:28PM -0600, Mike Jensen wrote:
>Humm what I have done in the past (not sure it is the best but what I do).
>Is I put the script in /etc/initd and then add a symbolic link to the
>/etc/rc3.d or what ever run level you are running in.

In Red Hat based systems I use the Red Hat format in the header and then
just do "chkconfig --add script" and "chkconfig script on".  In
Debian-based systems I usually will manually add symlinks, because I can
never seem to get update-rc.d to do the right thing for me, and certainly
not as easily to remember as making the links.

However, it really depends on the service.  I often will add services I
build to /etc/inittab, so that they get restarted if the daemon dies.
Preferably with a "2>&1 | logger -t servicename" after the service, or
wrapped in a script that does this.

SuSE uses a dynamic startup mechanism that calculates dependencies at boot
time depending on the comments in the headers.  I haven't looked at the URL
that taggart pointed to, but they may be using that format.  In theory this
should be nice and easy to figure out, but I always have to spend a lot of
time poking at it to get it right.  It's kind of nice that you don't need
the rc*.d directories though.

FreeBSD is exactly the same way as SuSE, though I'm pretty sure they use
different tagging.

On OpenSolaris you have to provide an XML file which describes the service.
This has the added benefit that you just define the dependencies and it
deals with the rest, including sequencing and parallel execution, but it
also provides service restart.  It's called SMF, if you want to check out
more about it.  It's kind of complicated, but it's great for serious system
administration.

SMF is also nice because it can tell you things about why a service isn't
running.  I had disabled xinetd on a server because I had no services I
wanted published via that, but then sshd stopped working.  I asked SMF
about it and it said "Hey, need xinetd running".  As soon as I enabled
xinetd, SSH restarted.

>> What's the current wisdom on the best place to put system-wide startup
>> scripts for things like server processes?  I've never really figured
>> this out, because our server hardly ever needs to start up, because it
>> hardly ever goes down....

All the more reason for getting it right and, more importantly, testing it
when you make changes.  I used to be all about having the maximum uptime
back in the <gasp> '80s, but more recently I'm quite happy to do a reboot
to test that services come up properly, so that I know that in an emergency
I won't be battling startup issues as well as other things.

Thanks,
Sean
-- 
 Have you ever imagined a world with no hypothetical questions?
Sean Reifschneider, Member of Technical Staff <jafo at tummy.com>
tummy.com, ltd. - Linux Consulting since 1995: Ask me about High Availability
      Back off man. I'm a scientist.   http://HackingSociety.org/




More information about the NCLUG mailing list