Revision ff917534
b/lib/daemon.py | ||
---|---|---|
241 | 241 |
self._signal_wait.append(owner) |
242 | 242 |
|
243 | 243 |
|
244 |
def GenericMain(daemon_name, optionparser, dirs, check_fn, exec_fn): |
|
244 |
def GenericMain(daemon_name, optionparser, dirs, check_fn, exec_fn, |
|
245 |
console_logging=False): |
|
245 | 246 |
"""Shared main function for daemons. |
246 | 247 |
|
247 | 248 |
@type daemon_name: string |
... | ... | |
258 | 259 |
@type exec_fn: function which accepts (options, args) |
259 | 260 |
@param exec_fn: function that's executed with the daemon's pid file held, and |
260 | 261 |
runs the daemon itself. |
262 |
@type console_logging: boolean |
|
263 |
@param console_logging: if True, the daemon will fall back to the system |
|
264 |
console if logging fails |
|
261 | 265 |
|
262 | 266 |
""" |
263 | 267 |
optionparser.add_option("-f", "--foreground", dest="fork", |
... | ... | |
325 | 329 |
stderr_logging=not options.fork, |
326 | 330 |
multithreaded=multithread, |
327 | 331 |
program=daemon_name, |
328 |
syslog=options.syslog) |
|
332 |
syslog=options.syslog, |
|
333 |
console_logging=console_logging) |
|
329 | 334 |
logging.info("%s daemon startup", daemon_name) |
330 | 335 |
exec_fn(options, args) |
331 | 336 |
finally: |
Also available in: Unified diff