Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/python
# -*- encoding: utf-8 -*-
#
# author: javi santana
import os
import logging
from daemon.runner import DaemonRunner
import myapp
class MyApp(object):
def __init__(self):
self.root = os.path.abspath(os.path.dirname(__file__))
self.run_dir = os.path.join(self.root, "run")
self.stdin_path = '/dev/null'
self.stdout_path = os.path.join(self.run_dir, 'stdout.txt')
self.stderr_path = os.path.join(self.run_dir, 'stderr.txt')
self.pidfile_path = os.path.join(self.run_dir,'test.pid')
self.pidfile_timeout = 1
def run(self):
logging.basicConfig(filename=os.path.join(self.run_dir, 'applog.log'),level=logging.DEBUG)
myapp.setup()
myapp.run()
DaemonRunner(MyApp()).do_action()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment