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.

I'm trying to create script for tomcat with my app as system service it's lika ok I can stop start status and restart. But I need when system going shutdown stop service fully and correctly, my app depend on a lot of resources like network and etc so seems that my service MUST be stopped first of any services. I know it can be configured somehow using special definitions like: chkconfig:, Default-Start:, Default-Stop: etc.

my current config:

#!/bin/sh
#
#       /etc/rc.d/init.d/my-service
#
# Starts the startup operations
#
# chkconfig: 345 26 74
# description: Start script for launch my service

### BEGIN INIT INFO
# Provides: my-service
# Default-Start:  2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start script
# Description: Start script for launch my service
### END INIT INFO

Please help me to understand this numbers and configure it as I need, Thanks!

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

For chkconfig only the following lines matter

# chkconfig: 345 26 74
# description: Start script for launch my service

Here is the explanation

345 -- Level on which to start the service. 25 --> startup priority. (i.E. this script will be run after all the other scripts with priority less than 26 have been executed) 74 --> shutdown priority ( i.e This script will be called after all the other scripts with priority less than 74 has been executed)

The other details, do not matter, if you are only using chkconfig under RHEL and its clones (Centos, scientific etc..)

The "INIT INFO" block is for compatibility with Debian. IF you are not going to run the init scripts under debian this does not matter and can be ignored.

choose a shutdown priority that lower than the dependencies, and obliviously the start priority needs to be higher than the dependencies

Also: this link might of use to you CentOS 5.5: service not stopped on shutdown

share|improve this answer
add comment

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.