“Como fazer um arquivo python executar em segundo plano” Respostas de código

Como verificar qualquer script está sendo executado no Linux em segundo plano usando o python

def check_process():
    import subprocess
    script_name = "test.py"
    cmd='pgrep -f .*python.*{}'.format(script_name)
    process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    my_pid, err = process.communicate()
    if len(my_pid.splitlines()) >0:
        print("Script Running in background")
        sys.exit(0);
check_process()
Sachin

Como fazer um arquivo python executar em segundo plano

#Cmd
C:\..\>cd DIRECTORY
C:\..\DIRECTORY>pythonw python.py
#Close in Task Manager

Respostas semelhantes a “Como fazer um arquivo python executar em segundo plano”

Perguntas semelhantes a “Como fazer um arquivo python executar em segundo plano”

Procure respostas de código populares por idioma

Procurar outros idiomas de código