Revision fd346851 lib/daemon.py
b/lib/daemon.py | ||
---|---|---|
487 | 487 |
self._signal_wait.append(owner) |
488 | 488 |
|
489 | 489 |
|
490 |
def GenericMain(daemon_name, optionparser, dirs, check_fn, exec_fn,
|
|
490 |
def GenericMain(daemon_name, optionparser, check_fn, exec_fn, |
|
491 | 491 |
multithreaded=False, console_logging=False, |
492 | 492 |
default_ssl_cert=None, default_ssl_key=None): |
493 | 493 |
"""Shared main function for daemons. |
... | ... | |
497 | 497 |
@type optionparser: optparse.OptionParser |
498 | 498 |
@param optionparser: initialized optionparser with daemon-specific options |
499 | 499 |
(common -f -d options will be handled by this module) |
500 |
@type dirs: list of (string, integer) |
|
501 |
@param dirs: list of directories that must be created if they don't exist, |
|
502 |
and the permissions to be used to create them |
|
503 | 500 |
@type check_fn: function which accepts (options, args) |
504 | 501 |
@param check_fn: function that checks start conditions and exits if they're |
505 | 502 |
not met |
... | ... | |
588 | 585 |
if check_fn is not None: |
589 | 586 |
check_fn(options, args) |
590 | 587 |
|
591 |
utils.EnsureDirs(dirs) |
|
592 |
|
|
593 | 588 |
if options.fork: |
594 | 589 |
utils.CloseFDs() |
595 | 590 |
utils.Daemonize(logfile=constants.DAEMONS_LOGFILES[daemon_name]) |
Also available in: Unified diff