daemoniker

raw JSON →
0.2.3 verified Fri May 01 auth: no python maintenance

Cross-platform daemonization tools for Python, supporting Windows via win32service and Unix via traditional forking. Current version 0.2.3, last released in 2018. Low release cadence, effectively in maintenance mode.

pip install daemoniker
error ModuleNotFoundError: No module named 'win32serviceutil'
cause pywin32 not installed on Windows.
fix
pip install pywin32
error ImportError: cannot import name 'SIGBREAK' from 'daemoniker'
cause Older version (<0.2) may not have SIGBREAK, or signal constants are not exported.
fix
Upgrade daemoniker: pip install --upgrade daemoniker
error AttributeError: module 'daemoniker' has no attribute 'Daemonizer'
cause Due to a packaging bug, importing daemoniker directly may not expose all names. Use correct import path.
fix
Use: from daemoniker import Daemonizer
gotcha On Windows, the daemoniker requires pywin32. Install with 'pip install pywin32' and ensure it's importable. The service will fail silently if missing.
fix Install pywin32: pip install pywin32
gotcha Daemonizer must be used as a context manager (with statement). Calling __init__ without the context manager will not daemonize the process.
fix Use 'with Daemonizer():'
gotcha On Unix, SIGBREAK is defined but not a standard signal. Using it may cause unexpected behavior. Prefer SIGTERM or SIGINT.
fix Use signal.SIGTERM instead if you need custom shutdown.

Basic daemonizing a background loop. On Unix, fork and detach; on Windows, runs as a service.

from daemoniker import Daemonizer
import time

with Daemonizer():
    while True:
        with open('/tmp/daemoniker.log', 'a') as f:
            f.write('Daemon running\n')
        time.sleep(5)