Skip to content

Instantly share code, notes, and snippets.

@deidyomega
Last active December 10, 2015 21:37
Show Gist options
  • Save deidyomega/b2b06319f2b443a27f9e to your computer and use it in GitHub Desktop.
Save deidyomega/b2b06319f2b443a27f9e to your computer and use it in GitHub Desktop.
import daemon
from main import my_main_loop
with daemon.DaemonContext():
my_main_loop()
def my_main_loop():
print "Hello World"

To Run:

Needs to be root to create deamon, there are ways around this, but for this simple program I didn't build it it

sudo su python daemonizer.py

There wont be an output, because the program main ran in the background.

If you want to see it do something, make the my_main_loop connect to a db, and place a record in it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment