[Nut-upsuser] CentOS 7, systemd, nut-monitor, and failing to shut down the UPS
Lee Damon
nomad at ee.washington.edu
Thu Feb 1 22:14:47 UTC 2018
I've been wrasslin' with a problem on a CentOS 7 host that I'm using as
my main NUT server.
When the battery gets low while the server is shutting down it is
supposed to signal the UPS to shut down as well. This is clear, well
documented, and The Right and True Thing to Do<tm>.
However, the default scripts provided in the EPEL RPM aren't actually
doing it. The host halts as expected but the UPS never gets the message.
After a lot of false leads and frustration I narrowed it down to the
/usr/lib/systemd/system-shutdown/nutshutdown script. It _appears_ that
the calls to "upsmon -K" and "upsdrvctl shutdown" can't actually do
anything because the USB device is in use. This _implies_ to me that
nut-driver is still running, even this late in the shutdown process.
I've "fixed" this problem by modifying the nutshutdown script:
#!/bin/sh
# stop nut driver to free up access to the device
/sbin/systemctl stop nut-driver
# make sure it has time to die
sleep 2
# check to see if we need to actually shutdown the UPS then do it
/usr/sbin/upsmon -K >/dev/null 2>&1 && /usr/sbin/upsdrvctl shutdown
This appears to have fixed the problem but it leaves me worried that
I've missed something critical and it's going to haunt me later.
Is anyone else on this list using the combination of NUT, systemd, and
CentOS/RHEL 7? How did/do you solve this problem?
thanks,
nomad
More information about the Nut-upsuser
mailing list