How can I keep a process alive after closing the putty session?

Solution 1:

I use screen for that kind of stuff. Actually sometimes I just leave it on quite a while so I can get back to what I was doing.

Update 2021: I also started using tmux lately.

Solution 2:

^Z
bg %1
disown -h %1

The '-h' makes the process immune to SIGHUP when the session completes.

Solution 3:

Use the nohup command. Just prefix it to your command and it will daemonise them so that they won't stop when you log off/terminate your shell session. The standard output will by default be in a file called nohup.out. Check the manual page for nohup(1) for more information.

Solution 4:

Start process with nohup "processname" &. You can also detach it with screen or tmux.

Solution 5:

The above solutions are quite well described, however, none of them worked for me UNTIL I also edited PuTTY configuration to :

Enable TCP keepalives (SO_KEEPALIVE option)

I hadn't seen this anywhere else, and just found it by trial and error.