Cosco had a great deal on Tripp-Lite OmniSmart 675's for under $200. This seemed like a good deal so I purchaced one. It had a monitoring port, cable and supposivly software for all kinds of operating systems. I didn't hold my breath for linux, so I wasn't disapointed when if found that the software didn't support linux.
In the past I've had experiance with Powerd-2.0 so I downloaded the code, compiled it, installed it, and tested it. It didn't work. I hacked on the code for a while, trying to make powerd-2.0 do what I wanted it to do without loosing any of powerd's functionality. The following is what I had to do to get it to work.
One of the major changes to Redhat linux that will cause powerd-2.0 to fail, is that the powerstatus file has moved from /etc/powerstatus to /var/run/powerstatus. This was a simple change to the powerd-2.0 code.
For some reason in the powerfail routine, it would exit when it should of written to the powerstatus file and notified Init about the power fail. There was this code that would always exicute and return instead of dropping thorough and doing the correct thing. I removed this code.
Once the above two things are fixed, powerd will start to work, but it will not shut off the UPS once we go to run level 0. I had to add some code that actually toggled the UPS powerdown line specifed in powerd.conf instead of just asserting it (powerd documentation claims that it pulses the line, it doesn't).
Finally, if the power comes back on during the shutdown sequence and the powerdown toggle doesn't work, the machine would just sit there forever. I added some code to check if the power is on at run level 0, if the power is on (came back on during shutdown), reboot the machine.
Grab the patch here.
The first is that when powerd is run it always pulses the UPS shutoff line. It should check to see if the UPS is powerd by the mains, and if so not pulse the shutoff line. This is no problem if the ups has power, since it can only be shut off if the mains are out. But it can cause problems if when the machine is coming up the power goes out. Your machine will shut off mid boot, ooouch! This will be my first fix for the next release of the patch.
The second fix is to monitor the battery low line of the UPS and do a shutdown without delay.
#
# run powerd
#
if [ -f /sbin/powerd ]; then
echo "Starting Powerd."
/sbin/powerd &
fi
echo "Remounting remaining filesystems (if any) readonly"
mount | awk '/ext2/ { print $3 }' | while read line; do
mount -n -o ro,remount $line
done
# << add these lines only!!!
# Run poward <<
# <<
/sbin/powerd & <<
# Now halt or reboot.
echo "$message"
[ -f /fastboot ] && echo "On the next boot fsck will be skipped."
eval $command -d
When I get time I'll put up the diagrams so you can make your own tripplite cable that is compatible with the above.