PHP exec() nohup with redirect -
i trying execute command exec() , redirecting stdout , stderr file.
exec("nohup python main.py -i 1 > /var/scripts/logs/1_out.log 2>&1 &");
it create file not print it.
if run command in terminal outputs without problem.
got working. python own output buffering kept writing file. running -u option disables this. final code looks this:
exec("nohup python -u main.py -i 1 > /var/scripts/logs/1_out.log 2>&1 </dev/null &");
thanks.
Comments
Post a Comment