Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On RHEL 6.3, I have a system service that should be starting after postgresql and httpd (order 64 and 85, respectively), but chkconfig always places it at order 50. I tried an experiment on a CentOS 6.0 virtual machine to make sure I understood the LSB stanza syntax.

I created /etc/init.d/foo, owner root, permissions 755, with this text:

### BEGIN INIT INFO
# Provides: foo
# Required-Start: postgresql httpd
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Foo init script
### END INIT INFO

And then ran chkconfig --add foo. Result: /etc/rc5.d/S86foo is created, as expected. (The other runlevels are also as expected.)

I repeated the exact same experiment on the RHEL machine, and it created /etc/rc5.d/S50foo instead. I can't see anything different between the two that would lead to different results. Both machines have postgresql and httpd starting at the same orders and runlevels. Any thoughts? I could just use # chkconfig: 2345 86 50, or manually rename the service symlinks to the correct order, but I'm trying to document an install process for later users, and I want to know how to do it right and understand why it's not working as expected.

share|improve this question
    
Your logic is correct. They should act the same. As a test, try changing the required start services to something else and see if it still drops it in order 50. The chkconfig man page suggests that the required start services must be enabled but it sounds like you've already confirmed that. –  kernelpanic Nov 4 '12 at 1:42
    
Do you have the same number of services in /etc/init.d on both machines? Isn't that number in the symlink just so that when init runs them, it evaluates them in the same order that ls would evaluate them? Is it possible that you have 85 startup scripts on CentOS but only 49 on Red Hat? –  user160910 May 21 '13 at 21:30
    
Do you have anything in /etc/chkconfig.d/ ? –  Mark Cohen Jun 18 '13 at 19:46

1 Answer 1

On RH systems you must use chkconfig line as documented:

https://fedoraproject.org/wiki/Packaging:SysVInitScript#.23_chkconfig:_line

Regarding chkconfig line:

The chkconfig: line in a SysV-style initscript is used to determine the runlevels in which the service should be started by default. It is also used to set the "priority", or order in which the services are started within a runlevel. All Fedora SysV-style initscripts must have this line.

Regarding LSB header:

Each Fedora SysV-style initscript which needs to start by default in any runlevel must include this line in the LSB Header, and it must match the list of runlevels defined for startup in the Chkconfig header.

share|improve this answer

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.