View Full Version : How do I recover a lost shell session because of modem connection dropping

19th May 2004, 05:49 AM

This may seem like a newbie question. I was logged into my colocated server from home via a dialup connection when the connection was dropped. I was in the middle of running rpmbuild to compile something.

Is there any way to reconnect and get back on the same shell session that I was on before my modem dropped the connection?

- Matt

20th May 2004, 12:01 AM
I doubt you can. Processes you start by default only run for the current session. Perhaps you have some processes that survived. Try running top or some process utility and filter for your name.

Next time try making your commands not hang up by running
nohup command

20th May 2004, 08:10 AM
I oncehave read that if you start a process in the background ( with & on the end of the command) it will run even if you log-off the shell. Try it start something like updatedb & and log off. And then come back and see whether it runs or no.

21st May 2004, 04:53 AM
Incorrect. When a shell session ends, it takes all of it's child processes (including background processes) with it. If you want to start something in the background and leave it running, you need to use nohup to disconnect it from the shell session.

Regarding recovering a remote shell session: it's gone. Depending upon the remote protocol (telnet, ssh, rsh) and the OS, the session may still be "running," but the programs running in it are attached to it, not the new one.

21st May 2004, 05:24 AM
See also: GNU screen (http://www.linux.com/article.pl?sid=04/04/06/1513220)

21st May 2004, 01:19 PM
thx for the information crackers :)

16th November 2004, 04:51 PM
The screen command can be used to start a recoverable shell session. The screen -r command can be used to recover a lost session. The screen -list command can be used to view sessions that can be recovered