Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
07-03-2007, 02:00 AM
|
#1
|
Member
Registered: Nov 2004
Distribution: Fedora Core 2
Posts: 330
Rep:
|
close terminal mean close background process?
Dear frens,
In moving a process to background. What i di was to type bg or Ctrl+z from the terminal.
But when i closed the terminal that also terminates the background process. How to I ensure that the background process are not terminated even after i close the terminal?
thanks
|
|
|
07-03-2007, 02:08 AM
|
#2
|
LQ Guru
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131
Rep: 
|
If you kill a process, all it's child processes should die too, that's the rule. So if you start a program (fore- or background) from a terminal, it becomes the child of that terminal and when you close the terminal, it's process dies and all the childs as well.
Easy solution: use a program called screen which enables you to run programs, detach them, log out of the whole machine if you like and when you return, just re-attach the session. Probably just what you're asking, right?
|
|
|
07-03-2007, 02:48 AM
|
#3
|
Member
Registered: Nov 2004
Distribution: Fedora Core 2
Posts: 330
Original Poster
Rep:
|
Thanks a lot friend!
|
|
|
08-17-2009, 08:13 AM
|
#4
|
LQ Newbie
Registered: Aug 2009
Posts: 13
Rep:
|
Quote:
Originally Posted by Niceman2005
How to I ensure that the background process are not terminated even after i close the terminal?
thanks
|
Use jobs to see bg processes.
Use disown to make child process free.
|
|
|
08-17-2009, 08:13 AM
|
#5
|
LQ Newbie
Registered: Aug 2009
Posts: 13
Rep:
|
|
|
|
08-17-2009, 07:53 PM
|
#6
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.x
Posts: 18,443
|
Just use nohup
nohup myprog &
|
|
|
05-27-2010, 10:46 AM
|
#7
|
LQ Newbie
Registered: May 2010
Posts: 1
Rep:
|
Quote:
Originally Posted by chrism01
Just use nohup
nohup myprog &
|
nohup redirects all the output to a new file named nohup.out. if you are running something big, it can get nasty
Last edited by tomtom85; 05-31-2010 at 10:48 AM.
|
|
|
05-27-2010, 02:58 PM
|
#8
|
Member
Registered: Oct 2005
Location: 127.0.0.1
Distribution: Manjaro
Posts: 963
Rep:
|
easiest i think is to use disown...
eg when i want to play an open GL game i need to change window manager and i do it like this
Code:
metacity --replace &
disown
the first command runs metactity as a background process, (sitll visible in jobs) but the second detatches it totally from the xterm i use
|
|
|
All times are GMT -5. The time now is 11:01 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|