Execute Subprocess in Background

后端 未结 2 398
盖世英雄少女心
盖世英雄少女心 2020-12-30 06:01

I have a python script which takes an input, formats it into a command which calls another script on the server, and then executes using subprocess:

import s         


        
2条回答
  •  天涯浪人
    2020-12-30 06:27

    If you want to execute it in Background I recommend you to use nohup output that would normally go to the terminal goes to a file called nohup.out

    import subprocess
    
    subprocess.Popen("nohup usr/local/bin/otherscript.pl {0} >/dev/null 2>&1 &", shell=True)
    

    >/dev/null 2>&1 & will not create output and will redirect to background

提交回复
热议问题