Start background process under bash
Tue Jan 25 12:09:00 GMT 2000
First, I'm adding the cygwin list back in the CC field. This is
"normal" for discussion, so others can add or modify (and correct ;-)
You mention using the DOS box "start /b" to get a process running in the
bash background. Since the start command is part of the CMD.EXE and not
of bash, I'm not sure I understand what you are doing. For a background
process in bash, you would run:
bash-02$ command args... &
which has always worked for me. The ampersand tells bash to start the
command but not wait for it to exit.
Using start in a cmd prompt sort of emulates UNIX background processes,
but I believe the process structure of windows results in a brand new,
unrelated to the original, set. (I am not an expert on this, though.
Perhaps others could provide a more precise explanation.) Suffice it to
say, I can do the following:
bash-02$ cmd /c "start bash"
and get a brand new window with a bash command prompt, where the new
bash process (in cygwin/unix terms) is its own parent. Normally, a
background process will have a parent PID equal to the process that
started it. If I add the /b option to the start command in the above
example, I get 2 bash shells competing for the single input focus. A
ps -f in a separate shell still shows that the bash running via the
start command is its own parent (so not a "true" background process) and
is not manageable using the bash 'jobs' command or the '%#' background
jobs referencing features.
I hope this helps point you in a useful direction.
Joe Burpee wrote:
> Bob McGowan wrote:
> > You didn't mention whether you are using the beta or CD version.
> I'm using B20.1 (beta); sounds like I should get the CD.
> > I am using the Cygwin CD 1.0, no updates, on both NT4 and NT2K and can
> > run processes in the background inside a scripts using the & without any
> > error popups (in fact, I am running a script now - actually puts a
> > function in the background, which is done by running multiple copies of
> > bash). You may want to try "standard" method again (in case you haven't
> > yet).
> I think my client's NT4 setup must be snafu. Using the DOS box command
> "start /b" I can get one process running in the bash background, but
> only one. And other processes, like readline, seem to be dead while the
> background job is running. I guess there's a process priority problem
> Thanks for the info. Some reason for optimism.
Staff Software Quality Engineer
Want to unsubscribe from this list?
Send a message to firstname.lastname@example.org
More information about the Cygwin