Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

succubus

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

succubus

Lightweight Python module for daemonizing

  • 1.0.post297
  • PyPI
  • Socket score

Maintainers
1

.. image:: https://travis-ci.org/Scout24/succubus.svg :alt: Travis build status image :align: left :target: https://travis-ci.org/Scout24/succubus

.. image:: https://coveralls.io/repos/ImmobilienScout24/succubus/badge.svg?branch=master :alt: Coverage status :target: https://coveralls.io/github/ImmobilienScout24/succubus?branch=master

======== succubus

Description

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

Examples

.. code-block:: python

#!/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:
            time.sleep(1)
            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')
        self.logger.addHandler(handler)


def main():
    daemon = MyDaemon(pid_file='succubus.pid')
    sys.exit(daemon.action())


if __name__ == '__main__':
    main()
    

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

.. code-block:: bash

#!/bin/bash
/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.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc