Skip to main content
Added a reference.
Source Link
geedoubleya
  • 4.5k
  • 1
  • 25
  • 22

The hyphen (-) found in an init script:

#!/bin/sh
#
# chkconfig: - 24 73

means that the service should not be started in any run levels by default, only stopped.

It replaces a list of run levels (e.g. 345) as shown below:

#!/bin/sh
#
# chkconfig: 345 24 73

Therefore if you use:

chkconfig --add <script>

then no start links will be created in any of the init directories.

$ ll rc*.d/*script*
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc0.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc1.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc2.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc3.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc4.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc5.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc6.d/K73script -> ../init.d/script

Notice only the Kill scripts links exist (K73script).

References:

A reference to this can be found on softpanorama.org:

The first line tells chkconfig what runlevels the service should be started in by default, as well as the start and stop priority levels. If the service should not, by default, be started in any runlevels, a - should be used in place of the runlevels list.

The hyphen (-) found in an init script:

#!/bin/sh
#
# chkconfig: - 24 73

means that the service should not be started in any run levels by default, only stopped.

It replaces a list of run levels (e.g. 345) as shown below:

#!/bin/sh
#
# chkconfig: 345 24 73

Therefore if you use:

chkconfig --add <script>

then no start links will be created in any of the init directories.

$ ll rc*.d/*script*
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc0.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc1.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc2.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc3.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc4.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc5.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc6.d/K73script -> ../init.d/script

Notice only the Kill scripts links exist (K73script).

The hyphen (-) found in an init script:

#!/bin/sh
#
# chkconfig: - 24 73

means that the service should not be started in any run levels by default, only stopped.

It replaces a list of run levels (e.g. 345) as shown below:

#!/bin/sh
#
# chkconfig: 345 24 73

Therefore if you use:

chkconfig --add <script>

then no start links will be created in any of the init directories.

$ ll rc*.d/*script*
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc0.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc1.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc2.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc3.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc4.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc5.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc6.d/K73script -> ../init.d/script

Notice only the Kill scripts links exist (K73script).

References:

A reference to this can be found on softpanorama.org:

The first line tells chkconfig what runlevels the service should be started in by default, as well as the start and stop priority levels. If the service should not, by default, be started in any runlevels, a - should be used in place of the runlevels list.

Source Link
geedoubleya
  • 4.5k
  • 1
  • 25
  • 22

The hyphen (-) found in an init script:

#!/bin/sh
#
# chkconfig: - 24 73

means that the service should not be started in any run levels by default, only stopped.

It replaces a list of run levels (e.g. 345) as shown below:

#!/bin/sh
#
# chkconfig: 345 24 73

Therefore if you use:

chkconfig --add <script>

then no start links will be created in any of the init directories.

$ ll rc*.d/*script*
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc0.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc1.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc2.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc3.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc4.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc5.d/K73script -> ../init.d/script
lrwxrwxrwx. 1 root root 17 Apr 24  2014 rc6.d/K73script -> ../init.d/script

Notice only the Kill scripts links exist (K73script).