Difference between revisions of "Disowning terminal programs so that they dont exit when terminal is closed"
(Created page with "<yambe:breadcrumb>Server_administration_tips_and_tricks|Server administration tips and tricks</yambe:breadcrumb> =Disowning terminal programs so that they dont exit when termi...") |
m |
||
Line 15: | Line 15: | ||
</pre> | </pre> | ||
where n is same as listed in jobs. Or simple use '<tt>disown</tt>' to disown all associated jobs. After disowning exiting the terminal wont send SIGHUP signal to process, allowing it to run until its formal completion. | where n is same as listed in jobs. Or simple use '<tt>disown</tt>' to disown all associated jobs. After disowning exiting the terminal wont send SIGHUP signal to process, allowing it to run until its formal completion. | ||
<yambe:breadcrumb>Server_administration_tips_and_tricks|Server administration tips and tricks</yambe:breadcrumb> |
Revision as of 07:24, 27 August 2018
<yambe:breadcrumb>Server_administration_tips_and_tricks|Server administration tips and tricks</yambe:breadcrumb>
Disowning terminal programs so that they dont exit when terminal is closed
Normally if we run program in background such as
./program1 >/dev/null 2>&1 &
and then exit terminal the program can continue running after terminal is closed. However if we start program using
./program1
and then use 'Ctrl+Z' and 'bg <n>' to send it to background then it remains connected to terminal such that if terminal is closed a SIGHUP is sent to the program to terminate it. To avoid this SIGHUP signal from being sent one can use
disown <n>
where n is same as listed in jobs. Or simple use 'disown' to disown all associated jobs. After disowning exiting the terminal wont send SIGHUP signal to process, allowing it to run until its formal completion.
<yambe:breadcrumb>Server_administration_tips_and_tricks|Server administration tips and tricks</yambe:breadcrumb>