Recipe 7.8. Manually Configuring Startup Services

7.8.1 Problem

You need to
manually configure your startup services, either because you think
using these fancy-schmancy utilities like
update-rc.d to manage your runlevels is sissy,
you don't care for the utility that your Linux
distribution provides, or you're stuck on some
strange barebones system with no helpful utilities.

7.8.2 Solution

Create entries in the /rc*.d directories with
the ln command. Delete entries for services
that are not going to be used at all.

As an example, let's create a nice soft link to
start up CUPS in runlevel 3:

# ln -s /etc/rc.d/init.d/cups /etc/rc.d/rc3.d/S90cups

Now repeat this for every runlevel. Don't forget the
"kill" runlevels:

# ln -s /etc/rc.d/init.d/cups /etc/rc.d/rc0.d/K01cups

Priority choices are 1-99. It doesn't matter if
there are duplicates; priority 20 is the most common. Priorities
usually aren't all that important, but some things,
such as firewalls and logging, should be assigned an early priority
between 1-10 (for starting up) and a late priority 80 or greater (for
stopping). Also, pay attention to sequence. For example, networking
needs to be started before services that depend on networking.

7.8.3 Discussion

Doing it this way is a little more work, but it's
you're no big deal—you're
just creating soft links. Remember, every service that you start must
also be explicitly stopped in all runlevels in which it is not going
to run. Also, some services in 0, 1, and 6 should not be killed, as
these are important system services created by Linux. Make a record
of these before changing anything:

$ ls /etc/rc0.d /etc/rc1.d /etc/rc6.d > original-runlevels.txt

Also include rcS.d, and any others that may be
hanging around. You can do anything you want in runlevels 2-5, but
take care not to mess up the others.