Created
March 21, 2010 17:13
-
-
Save javisantana/339430 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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