Dumb question - how to fork in a shell script

Jason jkenner@mindspring.com
Wed, 08 Nov 2000 07:57:55 -0700


"Shawn T. Rutledge" wrote:
> 
> If a program calls a shell script, how can the shell script execute another
> shell script in the background, in such a way that the second script will
> keep executing after the first one exits?  I tried just appending an
> ampersand, but it seems like the second script is being killed as soon
> as the first one exits.  I thought maybe exec does this, but the bash
> man page says that "exec command" causes the command to replace the
> shell as the current process, rather than to start a new process.  I
> need it to actually fork instead.
> 
> The context is that I'm trying to get vgetty to convert the .rmd files
> (some weird sound format) into .wav files as it receives them, but that
> causes vgetty to block until this conversion process is done, and it
> can't answer the phone again until it's done.  The conversion should be
> a background process.

Weird - I havent had the second one die when the first one exits, but
your calling the script from other than the usual means.

I believe the answer to your problem may lie in the nohup command, as
your process is really dying not because the script exits, but because
its I/O pipe vanishes when the calling script exits.

-- 
jkenner @ mindspring . com__
I Support Linux:           _> _  _ |_  _  _     _|
Working Together To       <__(_||_)| )| `(_|(_)(_|
To Build A Better Future.       |                   <s>