I have a simple python script that just starts an infinite while loop and prints "running". When I run it with nohup in the background, I see the nohup.out file in the current directory, but nothing is ever written to it. I'm confused. I tried the following
nohup test.py
writes in nohup.out, but obviously does not work in the background
nohup test.py &
works in the background, but does not write nohup.out
nohup test.py 2>&1 &
also works in the background, but does not write nohup.out
I bet I missed something simple. Any ideas?
Here is my python script for reference:
import sys from time import sleep def main(): print "Starting...." while True: print "running..." sleep(5.00) if __name__ == "__main__": main()
source share