mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-11-23 04:37:57 +00:00
A service that found another instance running (a manual run during maintenance) exited three times inside the start limit and stayed failed after the other instance stopped. The new --wait-for-lock flag retries the single-instance lock every 5 seconds instead of exiting 1, announcing the wait once, and resolves db_path on every attempt so an edit during the wait is honored. The systemd unit and the Debian package's unit start the bot with it.
53 lines
1.4 KiB
Desktop File
53 lines
1.4 KiB
Desktop File
[Unit]
|
|
Description=MeshCore Bot - Mesh Network Bot Service
|
|
Documentation=https://github.com/agessaman/meshcore-bot
|
|
After=network.target
|
|
Wants=network.target
|
|
|
|
# Restart policy. These belong in [Unit], not [Service] — systemd 230 moved them,
|
|
# and it silently ignores them anywhere else. Give up after 3 starts in 60 s so a
|
|
# bot that cannot reach its radio lands in `failed` instead of looping forever.
|
|
StartLimitIntervalSec=60
|
|
StartLimitBurst=3
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=meshcore
|
|
Group=meshcore
|
|
WorkingDirectory=/opt/meshcore-bot
|
|
ExecStart=/opt/meshcore-bot/venv/bin/python /opt/meshcore-bot/meshcore_bot.py --config /etc/meshcore-bot/config.ini --wait-for-lock
|
|
ExecReload=/bin/kill -HUP $MAINPID
|
|
Restart=always
|
|
RestartSec=10
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
SyslogIdentifier=meshcore-bot
|
|
|
|
# Environment variables
|
|
Environment=PYTHONPATH=/opt/meshcore-bot
|
|
Environment=PYTHONUNBUFFERED=1
|
|
|
|
# Security settings
|
|
NoNewPrivileges=true
|
|
PrivateTmp=true
|
|
ProtectSystem=strict
|
|
ProtectHome=true
|
|
UMask=0077
|
|
ConfigurationDirectory=meshcore-bot
|
|
ConfigurationDirectoryMode=0700
|
|
StateDirectory=meshcore-bot
|
|
StateDirectoryMode=0700
|
|
LogsDirectory=meshcore-bot
|
|
LogsDirectoryMode=0750
|
|
ReadWritePaths=/etc/meshcore-bot
|
|
ReadWritePaths=/var/lib/meshcore-bot
|
|
ReadWritePaths=/var/log/meshcore-bot
|
|
|
|
# Resource limits
|
|
LimitNOFILE=65536
|
|
MemoryMax=1G
|
|
CPUQuota=200%
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|