Launching And Detaching



I'm using one simple program to launch some daemons. When I launch a
program, I use backticks. (This is all on Linux, in bash, btw.) I've
added "2>&1 >/dev/null &" to the command line, so it's like this:

`/path/to/program 2>&1 >/dev/null &`;

I've noticed that if I include the '&' so the program detaches from the
shell, if I kill the launching program, the child process survives. I've
also tried this by forking first:

if (!fork()) {
`/path/to/program 2>&1 >/dev/null &`;
exit;
}

I had the hope that if I forked and launched like this, once all the
programs were launched, the launching program would exit. It doesn't. Is
there a way I can launch a program, then have the first program exit, so
it's no longer using that bash instance (without killing it)?

Thanks!

Hal

.



Relevant Pages

  • Re: shell changed configuration
    ... Davide Bianchi wrote: ... but if i launch "bash" from the prompt, it returns with the old appearence ... it seems that it no longer launches the bash prompt: ...
    (comp.os.linux.setup)
  • Re: [SLE] Good Mail Reader that can be launched from xterm???
    ... after you got Super-User priviledges and assuming you use bash: ... And then launch the graphical application you want.. ... >Xlib: No protocol specified ...
    (SuSE)
  • Re: Bash globbing files only?
    ... How can I list files instead of directories with Bash? ... Oh, well, I guess I'll need to waste some CPU cycles and launch ... find everytime I need to know file names in the current directory. ...
    (Fedora)
  • Re: How to deploy Java Applications To People W/O Having To Use The Command Line?
    ... btw.. ... The point of regenerating once every two minutes is to ... demonstrate the auto-update aspect. ... and launch the do nothing app, click again quickly, you'll note it ...
    (comp.lang.java.programmer)
  • Re: [opensuse] Audacity on 10.2
    ... Okay, I updated to 1.3.4-2.pm.beta and it's segfaulting at launch, now. ... BTW, ... libSoundTouch had to be downgraded before the package would install. ...
    (SuSE)

Loading