On 2011-10-19 10.23, Paul de Weerd wrote: > | I think your methodology is fllawed. think of the situations when you > | have power loss, then shutdown is started and then power is back. > | or situations where you starting machine after blackout and then there > | is a blackout again... > | With good ups you at least have 'switch off after some time is gone" > | option. > > You can build a lot of logic in the way you do this, including 'switch > off after some time is gone'. Really the only thing you get with > 'good ups' is an indication of how long your battery is going to last, > which might even resemble something close to reality if you're lucky. > > Don't get me wrong: 'proper' upses have a lot of benefits, but that's > mostly related to the ease of doing this controlled power down in case > of blackouts.
Well, Gregory is right in a way. The one flaw there is with my "poor man's UPS watchdog" is that there is no way to get the server going again if power is restored after the script decides to shut the server down but before the UPS runs out of battery juice and actually shuts off the power to the server. In that case, when power is restored the server will never have had its power cycled, so can never turn back on again even if you set its bios to boot when power is applied regardless of its state before power outage. What we can do in that case is to "almost" power it off, that is, shut down all services, get down to single user mode, unmount all volumes except for root which is remounted read-only, and then just wait. Either the server will eventually die, in which case it will boot back up as good as new when power is next applied, or the power will get back on in which case the script can detect that and simply do a reboot. Regards, /Benny -- internetlabbet.se / work: +46 8 551 124 80 / "Words must Benny Lofgren / mobile: +46 70 718 11 90 / be weighed, / fax: +46 8 551 124 89 / not counted." / email: benny -at- internetlabbet.se