Files
monitor-py/monitor-py.service.example

25 lines
752 B
Plaintext

[Unit]
Description=PC Monitor — MQTT system stats for Home Assistant
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=USERNAME
WorkingDirectory=/opt/monitor-py
ExecStart=/usr/bin/python3 /opt/monitor-py/monitor.py
# Required for xprintidle to query the X server for session idle time.
# Adjust :0 if your display is on a different number (check 'echo $DISPLAY').
Environment=DISPLAY=:0
Environment=XAUTHORITY=/home/USERNAME/.Xauthority
Restart=on-failure
RestartSec=10
# Give the process up to 10 s to publish its offline LWT before force-kill
TimeoutStopSec=10
# Logging goes to the journal; view with: journalctl -u pc-monitor -f
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target