I have an old python script that includes print commands. Sometimes I need to run this script in the background with no terminal associated (I think). Sometimes the script crashes. Could this be the reason? What would a solution be?
I described this badly. Here is what happens:
I run the script with & at the end from a terminal window. It works fine. I then close the window. It crashes.
The script does not crash but is terminated by the closing terminal.
You need to start the script using the
nohupcommand:Even better (if you want to catch the output to stdout):