starting programs as a daemon

From: andy (andy_at_earthsong.free-online.co.uk)
Date: 01/11/05


Date: Mon, 10 Jan 2005 23:29:05 +0000

Is there a standard way to start a program as a daemon from a script (with
init as parent process and no tty) which works in all linux distributions?

I've written an init script which starts several other programs. I'm
starting each program that's running in the background with nohup, which I
thought would stop it dying when the parent process exits, but this isn't
working.

E.g. if i run the script inside an xterm using 'xterm -e /init/script
restart', then kill the xterm, all the programs the script starts die as
well. This doesn't happen if I run it from a console then log out.

What I want is something I can use to start a program in the background
that will leave it running whatever happens to the process that started it.

I've looked through the man pages and I can't find anything that will do
this.

thanks, andy.



Relevant Pages

  • Re: starting programs as a daemon
    ... >> Is there a standard way to start a program as a daemon from a script (with ... >> init as parent process and no tty) which works in all linux distributions? ...
    (comp.os.linux.misc)
  • Re: starting programs as a daemon
    ... > init as parent process and no tty) which works in all linux distributions? ...
    (comp.os.linux.misc)
  • Re: Korn Shell conundrum
    ... > Hi I wonder if someone might be able to help me as I'm going nuts ... > that directory once the script has executed. ... > The parent process will remain in its current working directory. ... > parent due to the exit! ...
    (comp.unix.shell)
  • Re: restart network without shutdown
    ... Screen will allow the script to complete, whereas your ssh session is killing it half/part way through... ... Processes which start from within screen don't get killed, because, screen, the parent process, is still running. ...
    (freebsd-questions)
  • Korn Shell conundrum
    ... that directory once the script has executed. ... Script "gothere" contains something like: ... The parent process will remain in its current working directory. ... needs to check several arguments that can be passed in to it, and exit ...
    (comp.unix.shell)