succubus
Description
succubus is a lightweight python module for a fast and easy creation of python daemons and init scripts.
Examples
#!/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"""
# TODO: don't log to /tmp except for example code
handler = WatchedFileHandler('/tmp/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()
Succubus implements the usual init script actions (start, stop, restart, status) in Python. So your init script can look like this:
#!/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.
Release files for succubus 1.0.post61
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| succubus-1.0.post61.tar.gz | 4.3 kB | Details |
Release files / succubus-1.0.post61.tar.gz
| Download URL | succubus-1.0.post61.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b0c9732318a425529e09ebc04ee6dea4d4cd7ff01b5bdb41628e362853a089bb
|
|
BLAKE2b-256 checksum How to use checksums |
036c598da10c449db55efdcf6ddb7089046308c178218afc93b92106f8c0254a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |