gnu screen http://www.gnu.org/software/screen/ is an application that runs in a terminal, creating a sort of virtual session. When you disconnect, screen continues to run as a detached entity, to which you can then re-connect later.
First, install screen if it is not already installed (it probably is).
Then log in to your server.
Start a screen session:
$ screen
Now you are in screen. Start your process. I'll assume it's called foo.py. You can start it as normal, or maybe you prefer to start it and send it to the background:
$ foo.py &
If you would rather NOT send it to the background (that is, you want to see it working in your terminal), then just start it normally - but then you will want to switch to a new screen:
$ foo.py
One the script starts running, press ctrl-a ctrl-c (that is, Create new screen).
This creates a new empty screen. Your script is still running, but it's running on the other screen. Prove it to yourself by typing ctrl-a ctrl-n (that is, go to Next screen).
When you are ready to log out, type:
$ screen -d
That detaches you from the virtual screen. In other words, everything is STILL running, just as you left it.
You can even close puTTY. Your server is still running screen and whatever you launched inside of it.
When you want to re-connect, log back on and re-attach to screen:
$ screen -raAd
Now you're back in screen. You might see the output of your foo.py command, or you may need to switch over to it with ctrl-a ctrl-n.
Either way, that's how it's done.
screen
to deal with this issue in the future. – goldilocks Mar 06 '15 at 02:16