I sometimes have long running processes that I want to kick off before going home, so I create a SSH session to the server to start the process, but then I want to close my laptop and go home and later, after dinner, I want to check on the process that I started before leaving work. How can I do that with SSH? My understanding is that if you break your SSH connection you will also break your login session on the server, therefore killing the long running process...
|
You want to be using GNU Screen. It is super awesome!
CTRL+a , d to detatch from your screen session
When you come back to your laptop:
Then check out the progress of your long-running process!
|
|||||||||||||
|
|
You can use
|
|||||||||||||
|
|
What you want to use is screen or even better a user-friendly wrapper around screen called byobu. Screen allows you to run multiple virtual terminal sessions in the same ssh session. A tutorial and help pages are available. byobu is a wrapper that allows to easily open new screens with a simple function key instead of key combination from ctrl-a. It also shows a status line with all the open virtual terminals which can be named. Another nice feature is the fact that all your screen can stay up while your ssh connection is disconnected. You just connect again via ssh and call byobu and everything is like before. At last some screenshots of byobu. |
|||
|
|
|
It might be worth noting that ssh -t lala screen -rxU moo will attach to the moo session on host lala ssh -t lala screen -S moo will create the moo session on host lala and ssh -t lala screen -S moo quux will create the moo session on host lala and run the program quux, quitting the session on completion. |
|||
|
|
|
If you haven't planned ahead and setup
|
|||||
|
|
I use NX NoMachine, which is free for me because it's only me. Essentially, it runs an X session on the server which you can connect to and disconnect from over and over. The X session keeps running when you're not connected. Connections can be made from anywhere. You can choose between floating windows or a single window containing a whole desktop (eg a complete Gnome desktop). The client (which you would run on your laptop) can be run on Linux, MacOS, Solaris or Microsoft Windows. In the latter case if you choose floating windows they appear individually on the Windows Taskbar. I use my Windows XP laptop (which I need for certain Windows-specific hardware I have) as a front end for my two Linux servers using NX Nomachine. I can even print to the printer attached to my Windows laptop from Linux. |
||||
|
|
