Difference between revisions of "Disowning terminal programs so that they dont exit when terminal is closed"

From Notes_Wiki
(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
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<yambe:breadcrumb>Server_administration_tips_and_tricks|Server administration tips and tricks</yambe:breadcrumb>
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Server administration tips and tricks]] > [[Disowning terminal programs so that they dont exit when terminal is closed]]
=Disowning terminal programs so that they dont exit when terminal is closed=


Normally if we run program in background such as
Normally if we run program in background such as
Line 15: Line 14:
</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.
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Server administration tips and tricks]] > [[Disowning terminal programs so that they dont exit when terminal is closed]]

Latest revision as of 15:56, 22 July 2022

Home > CentOS > CentOS 6.x > Server administration tips and tricks > 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.


Home > CentOS > CentOS 6.x > Server administration tips and tricks > Disowning terminal programs so that they dont exit when terminal is closed