#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import subprocess
np_mpi = "1"
s_port = "11111"
cmd = "/data/ParaView/bin/mpiexec" + " -np " + \
np_mpi + " /data/ParaView/bin/pvserver " + \
"--server-port=" + \
s_port + " -display " + " :0.0 " + \
" --force-offscreen-rendering "
subprocess.call(cmd, shell=True)
I need run this subprocess, but I want that run in the background, and not kill it if main process dies. How do I do it? How to do it without echo on terminal?
For the moment this works but, no it continue with the rest of script python...
...update... I try
subprocess.Popen(['nohup', cmd],
stdout=open('/dev/null', 'w'),
stderr=open('log.log', 'a'),
preexec_fn=os.setpgrp
)
but the log file shows
nohup: failed to run command ‘/data/ParaView/bin/mpiexec -np 1
/data/ParaView/bin/pvserver --server-port=11111 -display :0.0 --force-
offscreen-rendering ’: No such file or directory
and the command its ok with
subprocess.call(cmd, shell=True)
Why does nohup fail?