I've seen many similar questions to this, but the problem is that none of the other solutions have fixed my issue. I want to run 2 python scripts and redirect their output to separate log files using nohup
.
This code is located in a bash script called startmain
:
nohup python3 GUI.py > GUI.log 2>&1 &
nohup python3 main.py > main.log 2>&1 &
When I run sh startmain
, the scripts both execute, but nothing is written to either log file.
Now let's say instead I change the startmain
code by removing the &
characters at the end of the line:
nohup python3 GUI.py > GUI.log 2>&1
nohup python3 main.py > main.log 2>&1
This code says I don't want the scripts running in the background, so only GUI.py runs; however, here it actually directs all the output from GUI.py to GUI.log. I know why main.py doesn't run here, but I don't know why the output is written to GUI.log in this case but not when I try and run the scripts in the background.
Any idea what my issue is here? What sets my question apart from the similar ones is that I'm executing 2 scripts, which could be a reason why it's not working.