Ensure UPS settings with volatile device memory - networkupstools/nut GitHub Wiki
Overview
Many devices accept settings over their protocol, although some of those only remember them until a power cycle.
In this case it is useful to have their NUT "primary" server re-write the settings whenever it starts.
Note that per discussions in e.g. issue #1993 currently (as of NUT v2.8.0 or earlier, as of this writing) an ups.conf
section attribute to override.something
sets a driver-known value but does not propagate it actually to the device when a driver starts.
systemd
Adapted from https://github.com/networkupstools/nut/issues/1993#issuecomment-1655232161 :
My work around: Make a script which are called from a systemd-timer unit at boot (and every 24 hours just in case).
Systemd-timer example:
Timer-file (/etc/systemd/system/nut_properties.timer):
[Unit]
Description="Set nut startup-properties"
[Timer]
OnBootSec=1min
OnUnitActiveSec=24h
[Install]
WantedBy=timers.target
Service-file (/etc/systemd/system/nut_properties.service)
[Unit]
Description="Set nut startup properties"
[Service]
Type=oneshot
ExecStart=/etc/nut/CustomStartupProperties.sh
Script-file: /etc/nut/CustomStartupProperties.sh
:; upsrw -w -s battery.charge.low=50 -u nut -p MyPass eaton@localhost
:; upsrw -w -s ups.delay.shutdown=120 -u nut -p MyPass eaton@localhost
:; upsrw -w -s ups.delay.start=125 -u nut -p MyPass eaton@localhost
The -w
parameter is very important when you call multiple upsrw
commands
Set permissions on the script-file:
:; chmod u=rwx,g=rwx,o=--- /etc/nut/CustomStartupProperties.sh