On 11/21/10 6:19 PM, Kill Script wrote:
I have a Java program that I want to start up with every boot, but I'm unsure how to do it.
There are two bootup scripts that start manually (script1.sh and script2.sh), and when the server gets shutdown, we have another script that we run (shutdownscript.sh) so that the DB does not get corrupted.
The RedHat/Centos way of doing things is to have init scripts in /etc/rc.d/init.d that take at least start, stop, and restart as arguments for each program that should start automatically. Then for the runlevels where you want them to start you have a symlink where the name starts with S and the rest is a number to make it sort alphabetically into the order that things should start in /etc/rc?.d (where the ? is the runlevel). Likewise add links starting with 'K' in the levels where the process should be stopped. There is a convention for comments in the scripts so that 'checkconfig program on' can make the links for you. Look through some of the other scripts to see how they work.