[PATCH] orbited --daemon argument

10 views
Skip to first unread message

Luke Macken

unread,
Oct 7, 2009, 3:32:34 PM10/7/09
to Orbited Discussion
Hey all,

In the process of packaging up Orbited for Fedora/Red Hat, we need
some way to daemonize the process. Below is a patch that adds a '--
daemon' argument that uses the python-daemon module.

Cheers,

luke

--- orbited/start.py.daemon 2009-06-16 22:24:38.000000000 -0400
+++ orbited/start.py 2009-10-07 11:23:01.112062529 -0400
@@ -81,6 +81,14 @@
default=False,
help="run Orbited on port 8000 and MorbidQ on port 61613"
)
+ parser.add_option(
+ "-d",
+ "--daemon",
+ dest="daemon",
+ action="store_true",
+ default=False,
+ help="run Orbited as a daemon"
+ )

(options, args) = parser.parse_args()

@@ -180,6 +188,15 @@
prof.runcall(reactor.run)
prof.close()
else:
+ if options.daemon:
+ try:
+ from daemon import DaemonContext
+ except ImportError:
+ print "Orbited in daemon mode requires python-daemon,
which is not installed. Get it from: http://pypi.python.org/pypi/python-daemon/"
+ sys.exit(1)
+ daemon = DaemonContext()
+ daemon.open()
+
reactor.run()

def start_listening(site, config, logger):
Reply all
Reply to author
Forward
0 new messages