0

I try running a python program on a remote server using nohup as explained in: How to keep processes running after ending ssh session?

When I do ssh server -C "nohup prog.py &", the python program exists with BrokenPipeError: [Errno 32] Broken pipe.

When I do ssh server -C "nohup prog.py", the python program runs smoothly, but the ssh connection obviously stays alive. Once I ctrl^c it, I get the Broken pipe error again.

Obviously I'm missing something here, but no idea what.

  • 1
    Is the program writing output to stdout/stderr? If so did you try to reroute that to file or /dev/null? – xenoid Dec 02 '18 at 09:24

2 Answers2

0

Like xenoid pointed out in the comment, redirecting the stdout/stderr to anywhere other than the screen fixed the problem.

0

Try GNU Screen (ssh server -t "screen python prog.py"). Screen will protect the process from dying. Use ^A then d to detach and screen -xr to reattach.

Mm2PL
  • 1