Skip to content

Instantly share code, notes, and snippets.

@baojie
Created September 5, 2013 22:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baojie/6457075 to your computer and use it in GitHub Desktop.
Save baojie/6457075 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import time
# sudo apt-get install python-daemon
from daemon import runner
class App():
def __init__(self):
self.stdin_path = '/dev/null'
self.stdout_path = '/dev/tty'
self.stderr_path = '/dev/tty'
self.pidfile_path = '/tmp/zzzfoo.pid'
self.pidfile_timeout = 5
def run(self):
while True:
print("I'm still up! see you in 10 seconds")
time.sleep(10)
app = App()
daemon_runner = runner.DaemonRunner(app)
daemon_runner.do_action()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment