#Systemd service file template for  Py MC - Meshcore Repeater Daemon.
#Install as /etc/systemd/system/pymc-repeater.service

[Unit]
Description=pyMC Repeater Daemon
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=repeater
Group=repeater
WorkingDirectory=/var/lib/pymc_repeater

# Start command - use python module directly with proper path
ExecStart=/usr/bin/python3 -m repeater.main --config /etc/pymc_repeater/config.yaml

# Restart on failure
Restart=on-failure
RestartSec=5

# Allow up to 10s for graceful shutdown before SIGKILL
TimeoutStopSec=10

# Resource limits
MemoryHigh=256M

# Logging
StandardOutput=journal
StandardError=journal
SyslogIdentifier=pymc-repeater

# Security (relaxed for service self-restart via sudo)
ReadWritePaths=/var/log/pymc_repeater /var/lib/pymc_repeater /etc/pymc_repeater
SupplementaryGroups=plugdev dialout

[Install]
WantedBy=multi-user.target
