Re: init.d startup script does not exit
On Sat, Sep 13, 2008 at 11:35:13PM -0700, rex wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello,
>
> I have a script that launches a program. If I launch this program
> manually, it keeps on running in the shell. It is a webserver, so I
> need it running all the time. However, if I exit the shell, it kills
> the webserver.
Which means that this program doesn't properly daemonize.
Use start-stop-daemon instead of writing your own. Some relevant
options:
-c, --chuid username|uid
Change to this username/uid before starting the process.
...
-b, --background
Typically used with programs that don’t detach on their own.
...
There are many other options there. It can help you creating a robust
script. One that will not attempt to run the daemon twice (something
your current script does not prevent).
Reference: start-stop-daemon
Examples: scripts under /etc/init.d
>
> I tried putting links to it in the rc0.d, rc1.d etc to make it start
> during startup, but it keeps on going during startup and never starts
> the other services.
Use update-rc.d rather than your own commands. It will safe you time,
eventually.
--
Tzafrir Cohen | tzafrir@jabber.org | VIM is
http://tzafrir.org.il | | a Mutt's
tzafrir@cohens.org.il | | best
ICQ# 16849754 | | friend
Reply to: