Prev |  |

## 58. The power came back during the shutdown, but before the UPS power off. Now the UPS does not reboot, and my computer stays off. How can I fix that?

There is a situation where the power may return during the shutdown process. This is known as a race. Here’s how we handle it.

"Smart" UPSes typically handle this by using a command that forces the UPS to power the load off and back on. This way, you are assured that the systems will restart even if the power returns at the worst possible moment.

Contact closure units (ala genericups), on the other hand, have the potential for a race when feeding multiple systems. This is due to the design of most contact closure UPSes. Typically, the "kill power" line only functions when running on battery. As a result, if the line power returns during the shutdown process, there is no way to power down the load.

The workaround is to force your systems to reboot after some interval. This way, they won’t be stuck in the halted state with the UPS running on line power.

Implement this by modifying your shutdown script like this:

            # `upsmon -K` if available on still mounted filesystems
            # at this point is more portable than the `test` below

            if (test -f /etc/killpower || /sbin/upsmon -K)
            then
                    /sbin/upsdrvctl shutdown

                    sleep 120

                    # uh oh, we never got shut down! (power race?)
                    reboot
            fi

Prev |  |
| Home |