[CentOS] best way to start and shutdown programs in CentOS?

Wed Nov 24 14:46:54 UTC 2010
Les Mikesell <lesmikesell at gmail.com>

On 11/24/10 8:20 AM, killscript wrote:
> Les Mikesell wrote:
>> 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.
>
> Sorry for the stupid question here, but does the /etc/initd./scriptname
> file "know" about these symlinks because of a particular comment in there?

The script itself doesn't need or do anything with the comments.  And I don't 
know if the format is documented anywhere but you can probably figure it out 
from the examples or just copy something that starts/stops where you want.

> Where and how is the best way to make these symlinks once you have the
> "correct" file configuration.

You can do it manually if you want, but chkconfig is easier.  Here's an article 
with some background. http://www.linuxjournal.com/article/4445.

-- 
   Les Mikesell
    lesmikesell at gmail.com