Sunday, December 21, 2014

Shell Scripting : Why closing a terminal kills all the programs running in it?

When a terminal is closed, it is sent SIGHUP signal. Before terminal exits, it sends SIGHUP to all jobs, which are either running or stopped in it. Stopped jobs are sent SIGCONT to ensure that they receive the SIGHUP.  

To prevent the shell from sending a SIGHUP signal to a particular job, the job should be removed from the jobs table using disown builtin command.

No comments:

Post a Comment