I'm writing a linux server program in python. I want the server to continue running after I close the terminal. And I find two way to implement it:
- use the
nohup
command: (orscreen
)
nohup python main.py >/dev/null 2>&1 &
Daemonize
the program by double-fork. Need to write additional python code. (How do you create a daemon in Python?)
I'm wondering what's the difference between the two implementations? Which one is prefered?