bmspy-ups selected its device from the devices that had data at startup, and exited with status 0 if the selection failed. One failed first read ended the monitor or made it select the wrong device. The server has a new DEVICES command that lists the configured names, and client.list_devices calls it. bmspy-ups selects from that list and then waits for the first data of its device. A wrong or missing --device now exits with status 2. The service file does not restart on that status, because a restart cannot correct it. An older server ends on the unknown DEVICES command, so update the server first.
17 lines
392 B
Desktop File
17 lines
392 B
Desktop File
[Unit]
|
|
Description=UPS monitoring for BMS
|
|
Requires=bmspy-server.service
|
|
|
|
[Service]
|
|
Type=exec
|
|
WorkingDirectory=/usr/local/bmspy
|
|
# Add --device NAME if bmspy-server reads more than one device.
|
|
ExecStart=uv run --no-sync bmspy-ups
|
|
RestartSec=5
|
|
Restart=on-failure
|
|
# Status 2 is a wrong option or device name. A restart cannot fix it.
|
|
RestartPreventExitStatus=2
|
|
|
|
[Install]
|
|
WantedBy=default.target
|