So, I need to run a python script on a server but I want the script to output whatever it outputs into a file so I can check what it done after it finished. However I also need the script to continue running if the ssh tunnel to the server gets interrupted or closed. Here is what I know:
python3 run.py >> out.txt
will output correctly.
nohup python3 run.py
will output correctly and be safe from interruption. it will also output into a nohup.out but will not run in the background of the current session (thus blocking me from doing anything else).
So I would think
nohup python3 run.py >> out.txt &
would work for me but it does not.
I've tried different combinations of what I want but just cannot get it to work...
once I add &
it appears the output to the files just stops going. I have no clue why though.
any help appreciated!