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

Class ZenDaemon

source code

     object --+    
              |    
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
 
sighandler_USR1(self, signum, frame)
Switch to debug level if signaled by the user, and to default when signaled again.
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
integer
watchdogCycleTime(self)
Return our cycle time (in minutes)
source code
integer
watchdogStartTimeout(self)
Return our watchdog start timeout (in minutes)
source code
integer
watchdogMaxRestartTime(self)
Return our watchdog max restart time (in minutes)
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, checkLogpath, generate_configs, generate_xml_configs, generate_xml_table, getConfigFileDefaults, parseOptions, pretty_print_config_comment

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]
  pidfile = None

Inherited from CmdBase.CmdBase: doesLogging

Properties [hide private]

Inherited from object: __class__

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.

watchdogCycleTime(self)

source code 
Return our cycle time (in minutes)
Returns: integer
cycle time

watchdogStartTimeout(self)

source code 
Return our watchdog start timeout (in minutes)
Returns: integer
start timeout

watchdogMaxRestartTime(self)

source code 
Return our watchdog max restart time (in minutes)
Returns: integer
maximum restart time

buildOptions(self)

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