Skip to main content

Lightweight Python module for daemonizing

Project description

Travis build status image Coverage status

succubus

Description

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

Examples

import logging
import sys

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(pid_file='succubus.pid')
    sys.exit(daemon.action())


if __name__ == '__main__':
    main()

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

succubus-1.0-15.tar.gz (3.7 kB view hashes)

Uploaded Source

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