Automated Documentation¶
This documentation is automatically built from the latest version of chr, located at the git repo.
-
class
mattdaemon.
daemon
(pidfile, daemonize=True, root=False, root_chk_argv=True, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null')¶ A generic daemon class.
Usage: subclass the Daemon class and override the run() method
-
__init__
(pidfile, daemonize=True, root=False, root_chk_argv=True, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null')¶ Make our daemon instance. pidfile: the file we’re going to store the process id in. ex: /tmp/matt-daemon.pid root: does this script require root? True if it does, False if it doesn’t. Will be enforced. root_chk_argv: does the script require ‘–requires-root’ in sys.argv to run as root? (usage is good) stdin: where the script gets stdin from. “/dev/null”, “/dev/stdin”, etc. stdout: where the script writes stdout. “/dev/null”, “/dev/stdout”, etc. stderr: where the script writes stderr. “/dev/null”, “/dev/stderr”, etc.
-
daemonize
()¶ 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
-
restart
()¶ Restart the daemon
-
run
(*args, **kwargs)¶ You should override this method when you subclass Daemon. It will be called after the process has been daemonized by start() or restart().
-
start
(*args, **kwargs)¶ Start the daemon
-
status
()¶ Check if the daemon is currently running. Requires procfs, so it will only work on POSIX compliant OS’.
-
stop
()¶ Stop the daemon
-