Processes in an SSH session belong to your shell's process; typically:
sshd [your-username] tty[your-tty]
.
When you kill your session, all child processes are also exited.
To get around this, use terminal multiplexing, or daemons.
The most common multiplexers are screen and tmux.
You would then start screen by using the screen -S my-session-name
, and running your process normally.
You can then press ctrl+a, d to detach from the screen, and the process will still be running, but as a child of screen, not your ssh session
To reattach, type screen -x my-session-name
(-r also works)
So why doesn't screen die for the same reason the python script does? – Mattias Åslund – 2013-11-21T18:30:54.687
Getting a memory error now, program doesnt run as far as it did before – John – 2013-11-21T18:35:40.267
1@MattiasÅslund screen creates another TTY in /tmp (a socket, really), that will have processes belonging to it, rather than using your current TTY (which will be in
/dev/tty[id]
), since that will go poof when sshd decides it's time to exit. you call screen; it's not invoked by your shell – Amelia – 2013-11-21T18:37:35.543@Anonymous are you sure you weren't running into swap space previously? – Amelia – 2013-11-21T18:38:40.220
I think so. Before I loaded data and processed it for some time and I guess when I exited, the process stopped. Now the program throws a memory error when loading the data, doesn't even get to the processing. – John – 2013-11-21T18:40:14.863
I tried it on a 64 bit server, worked. Weird though, worked on the 32 bit before. Thank you. – John – 2013-11-21T19:12:43.590