[vox-tech] possible to exit ssh with a program running?
Rob Rogers
vox-tech@lists.lugod.org
Thu, 23 Oct 2003 09:14:06 -0700
On Thu, 23 Oct 2003 08:17:47 -0700, Jonathan Stickel
<jjstickel@myrealbox.com> wrote:
> I know that if I start a terminal window in X, run a program, and then
> manually close the window, the program dies. I also know that if I
> secure-shell into another machine and run a program, I cannot exit
> without first ending that program.
>
> Is there any way to start a program for a shell window and leave it
> running when I close the window? Also, is there anyway to leave a
> program running remotely, started through an ssh session, and exit ssh?
>
> The later would be very helpful, although I suspect these two issues are
> related. My research involves running computer simulations on several
> computers on campus. I would really like to ssh into the machines from
> home, start the simulations (which generate output to text files), and
> then exit the ssh sessions with the simulations in progress. This way I
> could close my internet connection (dial-up :( ) and turn my home
> computer off while the multi-day simulations run.
man screen
SCREEN(1)
SCREEN(1)
NAME
screen - screen manager with VT100/ANSI terminal emulation
SYNOPSIS
screen [ -options ] [ cmd [ args ] ]
screen -r [[pid.]tty[.host]]
screen -r sessionowner/[[pid.]tty[.host]]
DESCRIPTION
Screen is a full-screen window manager that multiplexes a physical
ter-
minal between several processes (typically interactive shells).
Each
virtual terminal provides the functions of a DEC VT100 terminal
and, in
addition, several control functions from the ISO 6429 (ECMA 48,
ANSI
X3.64) and ISO 2022 standards (e.g. insert/delete line and support
for
multiple character sets). There is a scrollback history buffer
for
each virtual terminal and a copy-and-paste mechanism that allows
moving
text regions between windows.
Screen lets you run a program (or programs) from inside it, and then
detatch from screen, essentially sending it to the background, and then
log out of the terminal while screen continues to run, keeping whatever
was running within it going.
Another nice feature of screen is it can create multiple windows-I like to
think of them as tabs, similar to how you can have multiple tabs in
gnome-terminal. I can for instance ssh into server1, run screen, start a
process, open a new tab, ssh to server2 in tab 2 and start a process
there, open tab3 and ssh to server3...etc.
Now once you have all your processes going, detatch from screen, log out
of server1, and close your internet connection. When you ssh back in to
server1 a week later, run screen and reattach to the running session. All
your tabs are still there, with your ssh connections still active.