pythonsshnohupnice

How to cancel a SSH connection while a process is running?


I am using ssh to connect to another (faster) computer in order to run some python code there. As I expect it to run several hours, I would like to disconnect after running it, like this:

$ ssh user@my-other-computer
$ python file.py &
$ exit 

However, if I try this, I get the message:

zsh: you have running jobs.

I tried using nohup:

$ nohup nice python file.py &

but to no avail.

How can I achieve my goal?


Solution

  • I don't know why nohup does not work (maybe because of the nice, it could work without the nice command) but there are alternatives: