Linux.com

Author Message
Joined: Jun 30, 2008
Posts: 148
Other Topics
Posted Nov 26, 2008 at 4:26:27 AM
Subject: Detaching a session... without screen?
Is there a way to detach a session or a process, so that it continues to run when you logout or drop your connection? And without using screen? I found out a little while ago that screen does this, but I am curious how to do this when screen is not installed (or I don't feel like using screen).

PerlCoder (http://indicium.us)

Back to top Profile Email Website
Florian N
Joined Oct 30, 2008
Posts: 23
Location:PA

Other Topics
Posted: Nov 26, 2008 4:55:57 AM
Subject: Detaching a session... without screen?
You ca always start any process or script directly with a new pid and detached from your screen by using the "&" value. Eg. tail -f /var/log/messages & That will start a tail of the log file in another pid and running it constantly until you kill the pid. Hope this helps.


A life to learn - Personal blog

Back to top Profile Email Website
PerlCoder
Joined Jun 30, 2008
Posts: 148

Other Topics
Posted: Dec 01, 2008 11:42:59 AM
Subject: Detaching a session... without screen?
Sorry -- I know you're the one helping me... but doesn't that just run the process in the background? If my ssh connection drops, or I logout, the process will die with it, right?

PerlCoder (http://indicium.us)

Back to top Profile Email Website
thobbs
Joined Oct 12, 2008
Posts: 238
Location:Texas!

Other Topics
Posted: Dec 01, 2008 6:53:40 PM
Subject: Detaching a session... without screen?
Yes, it would die. I'm not sure, but inittab ([url]http://www.netadmintools.com/html/5inittab.man.html[/url]) might work if you use it correctly.
Back to top Profile Email Website
PerlCoder
Joined Jun 30, 2008
Posts: 148

Other Topics
Posted: Dec 04, 2008 2:04:08 AM
Subject: Detaching a session... without screen?
I just found out -- there is a command called nohup that can be used for this purpose. Also, apparently bash has a built in command (disown -h job) that can prevent background processes from receiving the SIGHUP signal. Lately I've been warming up more to screen. It seems fairly easy to reconnect to detached screen sessions, which is quite convenient.

PerlCoder (http://indicium.us)

Back to top Profile Email Website
thobbs
Joined Oct 12, 2008
Posts: 238
Location:Texas!

Other Topics
Posted: Dec 04, 2008 2:26:47 AM
Subject: Detaching a session... without screen?
That's pretty interesting. Thanks for the follow-up.
Back to top Profile Email Website
proopnarine

Joined Apr 03, 2008
Posts: 590
Location:San Francisco

Other Topics
Posted: Dec 04, 2008 5:02:06 AM
Subject: Detaching a session... without screen?
Yes, using the "&" simply places the process in the background and it dies when you log out. I didn't know about the nohup option; sounds interesting. But I use screen a lot to run long simulations remotely, and it works like a charm.

Take the red pill

Climate Change Blog

Food Weblog

Back to top Profile Email Website
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya