sgb1010@hotmail.com writes:
> Greetings!
>
> Is there a way to leave a connection open in SSH, something as a
> 'session' which can be restored later?
I think you're about to fall in love with Gnu screen.
> My scenario is the following: I connect to a remote machine (which has
> sshd) via SSH, run octave, run a long script (which will probably take
> about a month to complete), hit Ctrl+Z, type BG. So far so good, my
> application goes to background.
>
> What I would like to do next would be to log out of this ssh connection
> and, when I return (with the same user), be able to fg %1 and return to
> the running program. Right now when I try to do this I get a message
> saying I can't, because there are jobs running on the background.
>
> Is there a way to accomplish this? Some configuration in sshd perhaps?
> I wouldn't like to have to leave two machines turned on whereas one
> would suffice.
ssh blah@remotehost
remotehost$ screen
[hit enter after swcreen's introductory comments]
remotehostinscreen$ . .bash_profile (if ya need to, screen doesn't always
fork as a login shell, so you may need to source this)
remotehostinscreen$ myfunprocess&
remotehostinscreen$ [Ctrl-a d]
[detached]
remotehost$ exit
Days later, from some completely different machine, reconnect to
remotehost via any method.
remotehost$ screen -r
remotehostinscreen$
you'll be right back where you were.
Think of screen as VNC for tty's. -r reconnects you. Ctrl-a
followed by d disconnects you. Or hell ust kill the terminal.
Screen is still there.
Enjoy! Screen rocks.
--
Todd H.
http://www.toddh.net/