[Nut-upsuser] CentOS 7, systemd, nut-monitor, and failing to shut down the UPS

Roger Price roger at rogerprice.org
Fri Feb 2 13:07:29 UTC 2018


On Thu, 1 Feb 2018, Lee Damon wrote:

> 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

I don't have NUT + systemd + CentOS/RHEL, but I'm confused by your script. 
"upsdrvctl" is a front end to your driver.  You are sending a command via 
upsdrvctl and via your driver _after_ you have stopped the driver?  And it 
works?

> How did/do you solve this problem?

I don't use the nutshutdown script, but rather a systemd service unit which is 
called much earlier in the shutdown process.  This allows logging of the action.
It's described in Appendix B.2 at 
http://rogerprice.org/NUT/ConfigExamples.A5.pdf#subsection.B.2

Roger



More information about the Nut-upsuser mailing list