Are certain parts of startup scripts necessary or just good practice

configurationinit-scriptstartup

I'm currently exploring creating a startup script in the form of a system process located in the /etc/init.d/ on my Fedora 14 Linux installation. It sounds like the following two lines are bare minimum requirements?

#!/bin/bash
# chkconfig: 345 85 15 (however on this one I've seen different combos)

What's the purpose of these lines? Is there a good resource that would help me understand how to better create these and other header lines for such a file?

Best Answer

Look at the docs file /usr/share/doc/initscripts-*/sysvinitfiles (On current F14, /usr/share/doc/initscripts-9.12.1/sysvinitfiles). There's further documentation here: http://fedoraproject.org/wiki/Packaging/SysVInitScript.

The chkconfig line defines which runlevels the service will start in by default (if any), and where in the startup process they'll be ordered.

# chkconfig: <startlevellist> <startpriority> <endpriority>

        Required.  <startlevellist> is a list of levels in which
        the service should be started by default.  <startpriority>
        and <endpriority> are priority numbers.  For example:
        # chkconfig: 2345 20 80

And, note that this all becomes obsolete with Fedora 15 and systemd.

Related Question