[CentOS] A problem with power outages

Sat Mar 24 11:33:26 UTC 2012
Timothy Murphy <gayleard at alice.it>

I have a CentOS-6.2 server in Italy.
Every few months the server gets into a strange state
and stops working after a power outage.
I should say that this does not occur after every power outage;
I suspect, but have no real evidence for this,
that if the power comes back too quickly
then the machine gets confused because it is in the middle of closing down.

If I am in Italy the solution is simple;
I just press the power button on the machine until it stops
and then switch it on again, and everything works fine.

I guess that the proper solution is to get a UPS.
PowerTrust (or Trust) UPS's are available at a reasonable price (€40-€50).
But I have one question about this solution.
What if the outage lasts longer than the "life" of the UPS, about 10 
minutes?
I'd actually like the UPS simply to halt the machine in the proper way
after say 1 minute; but can this be arranged?
(If the machine knew it had gone onto UPS,
this could be arranged fairly simply.)

There is one other possibility.
There is a Billion modem/router between the ADSL input and the computer.
This does not seem to have any problem with power outages.
So if it were possible to send a message to the router
which would cause the computer to be turned off and on again,
that might offer an alternative solution.
One problem with this is that the Italian ISP 
only offers a dynamic IP address.
I run ddclient with dyndns on the server to translate this
into a fixed domain-name.
But this means that any action of this kind would have to be taken
before the IP address changes.
I think it usually stays the same for several days,
but I guess this might not be true if there is an outage at the ISP's site,
during a big electric storm.

Any suggestions, advice or experience of this problem gratefully received.

-- 
Timothy Murphy  
e-mail: gayleard /at/ eircom.net
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College Dublin