RAVE
Lib.rave_daemon.Daemon Class Reference

A generic daemon class. More...

Inheritance diagram for Lib.rave_daemon.Daemon:
Lib.rave_pgf_logger.rave_pgf_logger_server

Public Member Functions

 __init__ (self, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null')
 Constructor.
 
 daemonize (self)
 Do the UNIX double-fork magic, see Stevens' "Advanced Programming in the UNIX Environment" for details (ISBN 0201563177) http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16.
 
 delpid (self)
 Deletes the PID file.
 
 start (self)
 Start the daemon.
 
 stop (self)
 Stop the daemon.
 
 restart (self)
 Restart the daemon.
 
 run (self)
 You should override this method when you subclass Daemon.
 

Public Attributes

 stdin = stdin
 
 stdout = stdout
 
 stderr = stderr
 
 pidfile = pidfile
 
 delpid
 

Protected Member Functions

 _isprocessrunning (self, pid)
 Checks if the process with provided pid is running by checking the /proc directory.
 

Detailed Description

A generic daemon class.

Usage: subclass the Daemon class and override the run() method

Constructor & Destructor Documentation

◆ __init__()

Lib.rave_daemon.Daemon.__init__ ( self,
pidfile,
stdin = '/dev/null',
stdout = '/dev/null',
stderr = '/dev/null' )

Constructor.

Parameters
pidfilestring to the file containing the PID
stdinstring path to where to direct stdin
stdoutstring path to where to direct stdout
stderrstring path to where to direct stderr

Reimplemented in Lib.rave_pgf_logger.rave_pgf_logger_server.

Member Function Documentation

◆ _isprocessrunning()

Lib.rave_daemon.Daemon._isprocessrunning ( self,
pid )
protected

Checks if the process with provided pid is running by checking the /proc directory.

Parameters
pid- the pid to check for
Returns
True if a process with provided pid is running, otherwise False

◆ daemonize()

Lib.rave_daemon.Daemon.daemonize ( self)

Do the UNIX double-fork magic, see Stevens' "Advanced Programming in the UNIX Environment" for details (ISBN 0201563177) http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16.

◆ delpid()

Lib.rave_daemon.Daemon.delpid ( self)

Deletes the PID file.

◆ restart()

Lib.rave_daemon.Daemon.restart ( self)

Restart the daemon.

◆ run()

Lib.rave_daemon.Daemon.run ( self)

You should override this method when you subclass Daemon.

It will be called after the process has been daemonized by start() or restart().

                

Reimplemented in Lib.rave_pgf_logger.rave_pgf_logger_server.

◆ start()

Lib.rave_daemon.Daemon.start ( self)

Start the daemon.

◆ stop()

Lib.rave_daemon.Daemon.stop ( self)

Stop the daemon.


The documentation for this class was generated from the following file: