[Nut-upsuser] Getting the UPS to cut power to the PC at the right time
Mark E. Hansen
meh at Winfirst.Com
Sat Sep 22 17:51:28 UTC 2007
I'm using the current development build of the NUT package (nut-2.3.0-r1114)
on a CentOS 4.5 Linux machine (essentially RedHat Enterprise Linux 4.5) and
a CyberPower 1200AVR UPS, connected via the USB interface.
I finally got the UPS to kill the power to my PC during the shut down process
(so the PC would be able to restart once the line power returned).
Once I upgraded to the current development release, the tools were able
to get the UPS to kill the PC power. However, I was still left with the
task of communicating this command to the UPS at the proper time during
the machine shut down process.
The instructions show adding the appropriate command to the 'halt'
script. However, by the time the script wants to send the command
to the UPS, it is no longer available due to the fact that the file
systems (including /proc/bus/usb) have been unmounted.
I think this is probably a problem that is specific to USB connections
only, as the serial communications would likely not be effected by
the operations carried out in the shutdown processing? Not sure about
that though.
My solution was to hijack each of the sections in the 'halt' script
that were unmounting file systems (and/or mounting them as read only),
and skipping these operations for the "/proc" and "/proc/bus/usb"
file systems if the "/etc/killpower" file exists. Basically leaving
"/proc" and "/proc/bus/usb" mounted read/write.
If this is typical of a USB installation, I wonder if others might
benefit from a README or FAQ entry explaining the above?
Thanks again to Arjen and the others for all the help in getting this
working!
More information about the Nut-upsuser
mailing list