succubus


Namesuccubus JSON
Version 1.0.post204 PyPI version JSON
download
home_pagehttps://github.com/ImmobilienScout24/succubus
SummaryLightweight Python module for daemonizing
upload_time2017-06-26 06:19:03
maintainer
docs_urlNone
authorStefan Neben, Stefan Nordhausen
requires_python
licenseApache License 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            .. image:: https://travis-ci.org/ImmobilienScout24/succubus.svg
    :alt: Travis build status image
    :align: left
    :target: https://travis-ci.org/ImmobilienScout24/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.
            

Raw data

            {
    "maintainer": "", 
    "docs_url": null, 
    "requires_python": "", 
    "maintainer_email": "", 
    "cheesecake_code_kwalitee_id": null, 
    "keywords": "", 
    "upload_time": "2017-06-26 06:19:03", 
    "author": "Stefan Neben, Stefan Nordhausen", 
    "home_page": "https://github.com/ImmobilienScout24/succubus", 
    "github_user": "ImmobilienScout24", 
    "download_url": "https://pypi.python.org/packages/33/4b/605a0c7e9c81e386eaf99128be6dfbcb37e0dc07c40e3e307451048a8ba1/succubus-1.0.post204.tar.gz", 
    "platform": "UNKNOWN", 
    "version": "1.0.post204", 
    "cheesecake_documentation_id": null, 
    "description": ".. image:: https://travis-ci.org/ImmobilienScout24/succubus.svg\n    :alt: Travis build status image\n    :align: left\n    :target: https://travis-ci.org/ImmobilienScout24/succubus\n\n.. image:: https://coveralls.io/repos/ImmobilienScout24/succubus/badge.svg?branch=master\n  :alt: Coverage status\n  :target: https://coveralls.io/github/ImmobilienScout24/succubus?branch=master\n\n\n========\nsuccubus\n========\n\nDescription\n===========\nsuccubus is a lightweight python module for a fast and easy creation of\npython daemons and init scripts.\n\nExamples\n========\n\n.. code-block:: python\n\n    #!/usr/bin/env python\n\n    import logging\n    import sys\n    import time\n\n    from logging.handlers import WatchedFileHandler\n\n    from succubus import Daemon\n\n\n    class MyDaemon(Daemon):\n        def run(self):\n            \"\"\"Overwrite the run function of the Daemon class\"\"\"\n            while True:\n                time.sleep(1)\n                self.logger.warn('Hello world')\n\n        def setup_logging(self):\n            # TODO: don't log to /tmp except for example code\n            handler = WatchedFileHandler('/tmp/succubus.log')\n            self.logger = logging.getLogger('succubus')\n            self.logger.addHandler(handler)\n\n\n    def main():\n        daemon = MyDaemon(pid_file='succubus.pid')\n        sys.exit(daemon.action())\n\n\n    if __name__ == '__main__':\n        main()\n        \nSuccubus implements the usual init script actions (start, stop, restart, status) in Python. So your init script can look like this:\n        \n.. code-block:: bash\n\n    #!/bin/bash\n    /usr/bin/my_succubus_daemon $1 --foo=42\n\nIf 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.", 
    "lcname": "succubus", 
    "bugtrack_url": null, 
    "github": true, 
    "coveralls": false, 
    "name": "succubus", 
    "license": "Apache License 2.0", 
    "travis_ci": true, 
    "github_project": "succubus", 
    "summary": "Lightweight Python module for daemonizing", 
    "split_keywords": [], 
    "author_email": "stefan.neben@immobilienscout24.de, stefan.nordhausen@immobilienscout24.de", 
    "urls": [
        {
            "has_sig": false, 
            "upload_time": "2017-06-26T06:19:03", 
            "comment_text": "", 
            "python_version": "source", 
            "url": "https://pypi.python.org/packages/33/4b/605a0c7e9c81e386eaf99128be6dfbcb37e0dc07c40e3e307451048a8ba1/succubus-1.0.post204.tar.gz", 
            "md5_digest": "956bb6d02ba5a9e5df2c55063775f1fe", 
            "downloads": 0, 
            "filename": "succubus-1.0.post204.tar.gz", 
            "packagetype": "sdist", 
            "path": "33/4b/605a0c7e9c81e386eaf99128be6dfbcb37e0dc07c40e3e307451048a8ba1/succubus-1.0.post204.tar.gz", 
            "size": 4555
        }
    ], 
    "_id": null, 
    "cheesecake_installability_id": null
}