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@xxxxxxxxxx | VIM is
http://tzafrir.org.il | | a Mutt's
tzafrir@xxxxxxxxxxxxx | | best
ICQ# 16849754 | | friend


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx



Relevant Pages

  • Re: init.d startup script does not exit
    ... I have a script that launches a program. ... it keeps on running in the shell. ... It is a webserver, so I ...
    (Debian-User)
  • Re: detect shell script language
    ... In the 'old' days, when a user typed in a command, the interactive shell would immediately pass it off to 'exec' to execute. ... So, on return from exec with an error status, the shell would fork a copy of itself to try and run the script. ... As a result of the above, it was hard to tell whether the script was a Bourne shell or C shell, so the convention was introduced of using the Bourne shell no op command, as the first line in a Bourne shell script. ...
    (Debian-User)
  • Re: Call for input on comp.unix.shell FAQ
    ... >> questions and just tell people to FAQ it. ... The other level is how to write shell scripts. ... How can I remove whitespace characters within file names? ... Why one shouldn't use "echo" in a script? ...
    (comp.unix.shell)
  • SHELLdorado Newsletter 1/2003 - July 6th, 2003
    ... The "SHELLdorado Newsletter" covers UNIX shell script related ...
    (comp.unix.questions)
  • SHELLdorado Newsletter 1/2003 - July 6th, 2003
    ... The "SHELLdorado Newsletter" covers UNIX shell script related ...
    (comp.unix.shell)