This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: bash and '&'


Wei Ku wrote:

>>>>I want to leave a simple program running after quiting the shell, and
>>>>even logging off. It's done under unix by adding '&'. I failed to do
>>>>this using cygwin32. Is it supposed to behave the same way under
>>>>cygwin32? What should I do?

>>>As far as I can tell, the only shell that will do what you describe is bash.
>>>Did you run bash or sh when you log in ?

>>i thought this was done with 'nohup'.
>>'&' only puts the process in the backgroup.
>>it doesn't make it ignore the HUP and QUIT signals,
>>or does it?

>You are right about '&' which originally means "background".

>However, if one runs a job with '&' in bash or use 'ctrl-z' + "bg"
>combination to send a job to background, the job will survive even one log
>out of bash with "exit" command. That it, it is still running with PPID = 1.
>This is "equivalent" to the functionality of "nohup" command. I accidentally
>found this nice feature on IBM AIX machine. After that, I have not used
>"nohup" anymore -- too lazy to type ;-)

>I do not know how bash achieves this. I just know that this is really great
>if one submits a long job without using "nohup" command and decide to log
>out. Based on the test I did on AIX machine, ksh did not do this. ( This is
>one of the reason I switch to bash. )

>Please correct me if my idea is not right. Also, if someone knows how this
>is done in bash, I would love to understand how it is done by bash.

presumably by setting background processes to ignore HUP signals.
i just looked at the code. there's a function nohup_all_jobs() that does
this but i couldn't find where it is being called.

read the source, luke :)

raf

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]