Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
    
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 Mar 15 '11 at 21:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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