daemon

systemd

Python daemon and systemd service

When using systemd, it is no need to implement daemon in main process. Systemd simply works with foreground services (default service type=simple. See Type=).

Hints:

Example:

import systemd.daemon
 
# long startup
# ...
# long startup done
systemd.daemon.notify('READY=1')
 
# start servicing
[Service]
Type=notify
ExecStart=/usr/bin/my_service
ExecStartPost=/usr/bin/my_service_client
Environment=PYTHONUNBUFFERED=1