Running process in the background

前端 未结 5 929
日久生厌
日久生厌 2020-12-17 03:24

I am finding hard to run a process at background using paramiko. I used :

stdin, stdout, stderr = ssh.exec_command(\'executefile.py &\') 
5条回答
  •  攒了一身酷
    2020-12-17 04:00

    exec_command isn't executing the command in an interactive shell, so "running a process in the background" doesn't really make sense.

    If you really want to do this, you could use the command nohup to start your process, and keep it alive when the session exits. Remember that you can't get stdin, stdout, or stderr when you do this, since you are detaching the process from the shell, so redirect them accordingly.

提交回复
热议问题