[CentOS] best way to start and shutdown programs in CentOS?
Les Mikesell
lesmikesell at gmail.com
Mon Nov 22 20:04:04 UTC 2010
On 11/22/2010 1:37 PM, Kill Script wrote:
>
>
> It may be tempting to use the rc.local, but that's the quick and dirty
> way and not good for the long-term sustainability and management of a
> system. There's no way to individually control any service running
> from there, and no way to stop it on shutdown.
>
>
> Yeah, thank you. I talked with the person who wrote the Java program,
> and he essentially said the same thing.
>
> I'm looking through his suggestions now, and he suggested a shutdown
> script. I others who have examples with pid.txt and "dirname $0". Not
> sure what these are and am googling them now.
Standard init scripts use some common functions to write the process ID
of the running program in a standard place so the 'stop' operation can
find it. A side effect of this is that if you have multiple instances
of a program running you have to have separate init scripts with
different names to control them. Also, you generally need root access
to start/stop with this facility. If your program doesn't otherwise
need root access and you want an ordinary user to have control you may
want to do it some other way.
--
Les Mikesell
lesmikesell at gmail.com
More information about the CentOS
mailing list