Background process and SIGHUP
- by Charles Salvia
My understanding is that a program that is associated with a terminal will receive the SIGHUP signal if that terminal is closed. This usually will terminate the program.
I also know that you can use the nohup command along with the & symbol to run the program in the background, and disassociate it from the terminal so that the program is not terminated when the terminal closes (on log out.)
However, suppose a program is run normally without nohup, but is then suspended using Cntl-Z. If the program is then resumed in the background using the bg command, will it receive the SIGHUP signal on log out?
Or to put it another way: if I have a program which is already running, and I don't want to stop it but I'd like to log out, can I suspend it using Cntl-Z and run it in the background using bg? Or will the program be terminated when I log out?