Skip to main content

Lightweight Python module for daemonizing

Project description

Description

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

Examples

import logging

from logging.handlers import WatchedFileHandler

from succubus import Daemon


class MyDaemon(Daemon):
    def __init__(self, *args, **kwargs):
        super(MyDaemon, self).__init__(*args, **kwargs)

    def run(self):
        """Overwrite the run function of the daemon class"""
        handler = WatchedFileHandler('succubus.log')
        self.logger = logging.getLogger('succubus')
        self.logger.addHandler(handler)
        while True:
            time.sleep(1)
            self.logger.warn('Hello world')


def main():
    daemon = MyDaemon(pidfile='succubus.pid')
    daemon.action()


if __name__ == '__main__':
    main()

Project details


Release history Release notifications | RSS feed

This version

1.0

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page