4

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?

4

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.

3

The first line is the "she-bang" and is used to execute the script without having to pass it as an argument to a shell command line. The second line is a comment and is understood only by the chkconfig program. It is used to ensure the script will start on a specific run-level.

  • To clarify a little more: the #! (shebang) line is necessary at the top of any script. The # chkconfig is a comment and has no influence on the execution of the script; it's used only by the administration program chkconfig. – Gilles 'SO- stop being evil' Mar 15 '11 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.