OS: Centos 5.7

My application script starts like this (/etc/init.d/myapp):

# chkconfig 2345 85 60
# description: my application controller
# processname: myapp


# Provides:          myapp
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Description:       Starts the myapp application

Chkconfig status

chkconfig --list | grep myapp

myapp            0:off   1:off   2:on    3:on    4:on    5:on    6:off

myapp accepts start | stop | restart | force-reload and they're all tested to work

myapp controller basically needs to start some daemon services for the application. If I run service myapp start after the system is rebooted, everything works fine. But for some reason, chkconfig is not starting it up automatically. Can anyone explain what I may be doing wrong?


Thanks to cjc's information, it appears that my application controller is loading prior to some required services such as mysql.

Here's the result of a quick search:

find /etc -name rc* -type d | xargs ls | grep myapp

So why is the order set to 50 when in the script I've set to 85(start) 60(stop)? And how can I change this?

Solution (as pointed out by cjc in comments to his answer)

Incorrect syntax:

# chkconfig 2345 85 60

Correct to (colon needed after chkconfig):

# chkconfig: 2345 85 60

chkconfig essentially makes a symlink from, say, /etc/rc3.d/S85myapp to /etc/init.d/myapp. Verify that those links exist. I assume they do, since the "chkconfig --list" is showing that they're "on".

Since you can execute /etc/init.d/myapp from prompt, but it doesn't occur during startup, my guess is that there's an issue with the PATH, or that a service that you need up and running before executing myapp is actually initializing after myapp. Remember that the scripts in /etc/rc3.d (or whatever your initial runlevel is) are executed in sort order. Verify that myapp has everything it needs to run.

(My guess it that there's a PATH issue, though)

| improve this answer | |
  • They're current showing up in /etc/rcx.d/S50myapp, and you're right, some services that are required load up after this. Like mysql is S62mysql. How can I change this sort order? – gAMBOOKa Dec 24 '11 at 15:08
  • Check the man page for chkconfig, the "RUNLEVEL FILES" section. Basically, the "# chkconfig 2345 85 60" line in your file. From that, it should be S85, which would start it after mysql. I guess you may have created the links prior to changing that line. In this case, I'd do "chkconfig --del myapp" to remove the links, and then "chkconfig --add myapp" to add them again. In the worst case, you can rename the symlinks in the /etc/rc?.d directories. – cjc Dec 24 '11 at 15:45
  • chkconfig --del myapp does delete all the symlinks. But chkconfig --add myapp again sets them S60myapp. If I rename them manually, it might be an issue in the future if someone else decides to make changes to the script. I can't understand why it's being set to 50 when I'm clearly setting it to 85 60. – gAMBOOKa Dec 24 '11 at 16:02
  • 1
    Looking at my /etc/init.d, I see the line is actually "# chkconfig: 2345 85 60". Check your syntax; don't miss the colon after chkconfig. – cjc Dec 24 '11 at 16:37
  • That was it! Thanks cjc. Appreciate your patience with this! – gAMBOOKa Dec 24 '11 at 18:26

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.