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

Mon Nov 22 02:20:12 UTC 2010
Kill Script <killscript at gmail.com>

On Sun, Nov 21, 2010 at 8:18 PM, John R Pierce <pierce at hogranch.com> wrote:

> you would create a script in /etc/rc.d/init.d/   called yourjavathing,
> which takes the parameter {start|stop} and optionally
> {reload|restart|status} ...  this script would include the header lines for
> chkconfig.   its run by init as the root user (but without any user login
> profiles).   If you want your javathing to run as a different user, you
> should invoke your script1.sh and script2.sh via su someuser -c
> "/path/to/script1.sh" ...
>

Thank you! This was very helpful.


>
> once this script exists, and you test it by invoking it as
> "/etc/rc.d/init.d/yourjavathing start" (and "... stop", etc), then
>
>     chkconfig --on yourjavathing
>
> will configure the OS to run it automatically at the runlevels that your
> chkconfig header lines specify.  and,
>
>    service yourjavathing start
>
> (or stop, etc) will manually start and stop the service.
>

Googling, I found this example:

http://www.linuxjournal.com/article/4445

and I think that I can easily modify this Oracle init.d example

http://www.linuxjournal.com/files/linuxjournal.com/linuxjournal/articles/044/4445/4445l1.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20101121/d056a342/attachment-0005.html>