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

Class ZenDaemon

source code

     object --+    
              |    
CmdBase.CmdBase --+
                  |
                 ZenDaemon
Known Subclasses:

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
 
convertSocketOption(self, optString)
Given a socket option string (eg 'so_rcvbufforce=1') convert to a C-friendly command-line option for passing to zensocket.
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
 
logname(self) 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
 
_sigUSR1_called(self, signum, frame) 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, getGlobalConfigFileDefaults, getParamatersFromConfig, loadConfigFile, parseOptions, pretty_print_config_comment, validateConfigFile

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__

logname(self)

source code 
Decorators:
  • @property

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