1

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!

1 Answer 1

2

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

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.