Good day,programmers. I have a problem. Please help. I am creating a service, which must load automatically when Linux is being loaded. So,I copied the script into the direc
Looks like the max priority is 99, at least on CentOS 6.5, which is what I'm playing with right now.
I was also facing this issue and it was not able to call stop function during shutdown. found the solution after trying so many suggestions on net. You need to add "touch /var/lock/subsys/" for start and rm -f /var/lock/subsys/" for stop functions in script. Stop may not work for first reboot as lock may be not available during shutdown but will start working from next reboot.
Enjoy....:)
Satya
Look at all the scripts that chkconfig
can turn on or off in /etc/rc.d/init.d, you'll notice that the top few comments are very important. See How-To manage services with chkconfig and service
#!/bin/sh
#
# crond Start/Stop the cron clock daemon.
#
# chkconfig: 2345 90 60
# description: cron is a standard UNIX program that runs user-specified \
# programs at periodic scheduled times. vixie cron adds a \
# number of features to the basic UNIX cron, including better \
# security and more powerful configuration options.
You have a script called listofprocesses
but to chkconfig
this script looks like crond
due to the 3rd line and thus it does not find any script called listofprocesses
You'll also most certainly want to change chkconfig: 2345 90 60
. Which says which run levels it should be on (in this case 2, 3, 4 and 5), what it's start order is (90) and what its kill order is (60).
You can check the service is correctly set up with chkconfig --list listofprocesses
.
Here is an excellent map of the elements that need to be in an init script, to implement what chkconfig and the init subsystem is doing, and what each element actually does:
http://www.tldp.org/HOWTO/HighQuality-Apps-HOWTO/boot.html
Just add the following line at the top:
# chkconfig: - 99 10
it should do the trick