[CentOS] automatic shutdown of UPS (and RAID1)
shadroth at gmail.com
Sat Oct 14 08:43:38 UTC 2006
I have an MGE UPS Pulsar Ellipse 600 USBS that I'm setting up with CentOS 4.4
I tried for some time to get it working with USB, but failed and I
have had much more success using the serial port.
I have managed to complete the whole install procedure (shown here:
http://www.networkupstools.org/doc/2.0.1/INSTALL.html )but I'm lost
when it comes to implementing the shutdown script.
I'm also using Software RAID1 for all partions (/, /boot, swap, and two others).
I've never edited shutdown scripts before and after a few days of
Googling and manual reading I'm still not sure what to do. Is it as
simple as just putting the script in a file in the rc0.d directory?
I'm not sure what the file should be named so the script is run at the
right time, and I don't know how to ensure the software RAID1 is ready
to be powered off.
Feel free to tell me to RTFM, just let me know which FM I should be
looking at. :-)
Here's the step I'm stuck on:
11. Edit your shutdown scripts: add upsdrvctl shutdown
You should configure your system to power down the UPS after the
filesystems are remounted read-only. Have it look for the presence
of the POWERDOWNFLAG (from upsmon.conf), using this as an example:
if (test -f /etc/killpower)
echo "Killing the power, bye!"
# uh oh... the UPS power-off failed
# you probably want to reboot here so you don't get stuck!
# *** see the section on power races in shutdown.txt! ***
Be careful: that upsdrvctl command will probably power off your
machine. Don't use it unless your system is ready to be halted by
force. If you run RAID, be sure the arrays are ready to lose power.
Your kernel's power-off routines may not execute.
Make sure that the filesystem(s) holding your UPS drivers and
configuration details are still mounted when that part of the script
is run. You need upsdrvctl, ups.conf, and any drivers for the
hardware on your system.
More information about the CentOS