skip to navigation
skip to content

succubus 1.0.post75

Lightweight Python module for daemonizing

Latest Version: 1.0.post239



succubus is a lightweight python module for a fast and easy creation of python daemons and init scripts.


#!/usr/bin/env python

import logging
import sys
import time

from logging.handlers import WatchedFileHandler

from succubus import Daemon

class MyDaemon(Daemon):
    def run(self):
        """Overwrite the run function of the Daemon class"""
        while True:
            self.logger.warn('Hello world')

    def setup_logging(self):
        # TODO: don't log to /tmp except for example code
        handler = WatchedFileHandler('/tmp/succubus.log')
        self.logger = logging.getLogger('succubus')

def main():
    daemon = MyDaemon(pid_file='')

if __name__ == '__main__':

Succubus implements the usual init script actions (start, stop, restart, status) in Python. So your init script can look like this:

/usr/bin/my_succubus_daemon $1 --foo=42

If the init script is called as /etc/init.d/my_succubus_daemon start, this will translate into /usr/bin/my_succubus_daemon start --foo=42 being called. The start parameter is consumed by the succubus framework, i.e. when your code does the command line parsing, it looks as if /usr/bin/my_succubus_daemon --foo=42 was called. You can now parse the --foo=42 parameter as you please.

File Type Py Version Uploaded on Size
succubus-1.0.post75.tar.gz (md5) Source 2017-06-19 4KB