A python script prints information to screen and then should go to background.
How to do that from within the script itself?
Update: To properly daemonize your process, use daemonize.
Original answer: Since the shell is waiting for your process to finish, the main process must terminate. You can use os.fork()
to fork off a child process and sys.exit()
from the parent process:
import os
import sys
if os.fork():
sys.exit()
# Child code goes here