Commit db518921 authored by Jerome Mariette's avatar Jerome Mariette

add an option to daemonize the server

parent 86eaadc3
......@@ -21,6 +21,7 @@ import sys
from functools import wraps
import time
import os
import argparse
try:
import _preamble
......@@ -149,5 +150,16 @@ class JFlowServer (object):
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--daemon", action="store_true", dest="daemon", default=False, help="Run the server as daemon")
args = vars(parser.parse_args())
# daemonize the server if asked to
if args["daemon"]:
from cherrypy.process.plugins import Daemonizer
Daemonizer(cherrypy.engine).subscribe()
# start the server
cherrypy.quickstart(JFlowServer())
\ No newline at end of file
cherrypy.quickstart(JFlowServer())
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment