Package ZenUtils :: Module ZenDaemon :: Class ZenDaemon
[hide private]
[frames] | no frames]

Class ZenDaemon

source code

CmdBase.CmdBase --+
                  |
                 ZenDaemon

Base class for creating daemons

Instance Methods [hide private]
 
__init__(self, noopts=0, keeproot=False)
Initializer that takes care of basic daemon options.
source code
 
openPrivilegedPort(self, *address)
Execute under zensocket, providing the args to zensocket
source code
 
writePidFile(self)
Write the PID file to disk
source code
 
setupLogging(self)
Create formating for log entries and set default log level
source code
 
changeUser(self)
Switch identity to the appropriate Unix user
source code
 
becomeDaemon(self)
Code below comes from the excellent recipe by Chad J.
source code
 
sigTerm(self, signum=None, frame=None)
Signal handler for the SIGTERM signal.
source code
 
becomeWatchdog(self)
Watch the specified daemon and restart it if necessary.
source code
 
niceDoggie(self, timeout) source code
 
buildOptions(self)
Standard set of command-line options.
source code

Inherited from CmdBase.CmdBase: buildParser, generate_configs, generate_xml_configs, generate_xml_table, getConfigFileDefaults, parseOptions, pretty_print_config_comment

Class Variables [hide private]
  pidfile = None

Inherited from CmdBase.CmdBase: doesLogging

Method Details [hide private]

__init__(self, noopts=0, keeproot=False)
(Constructor)

source code 
Initializer that takes care of basic daemon options. Creates a PID file.
Overrides: CmdBase.CmdBase.__init__

setupLogging(self)

source code 
Create formating for log entries and set default log level
Overrides: CmdBase.CmdBase.setupLogging

becomeDaemon(self)

source code 
Code below comes from the excellent recipe by Chad J. Schroeder.

buildOptions(self)

source code 
Standard set of command-line options.
Overrides: CmdBase.CmdBase.buildOptions