Koozali.org: home of the SME Server

Last Power State

Offline Brave Dave

  • *
  • 185
  • +0/-0
Last Power State
« on: February 09, 2010, 01:54:22 AM »
I was set an interesting challenge

Standard Monitoring of UPS, power out extended so shutdown
but they want to .... have the server come back up automatically when the power comes back on

Setting BIOS to last powerstate is a pre-requisite, but..

How can I do this: if you change things you are going to get caught one way or another, use system halt instead of powerdown, what if the power doesn't go off - you are caught anyway

I'm thinking the procedure is
  • Set the Grub timeout to 300 seconds
  • Change the SHUTDOWNCMD to reboot

Then the machine will get low power at 5 minutes out and go into reboot waiting 5 minutes at grub screen, if the power goes off, last power state will kick in, otherwise it will startup from the reboot .. oh well all restarts will take 5 minutes - if they really want that

There isn't a reboot delay option, shutdown -t waits before the kill signal is sent, need a delay after the kill before the reboot
.:DB:.

Offline pfloor

  • *****
  • 889
  • +1/-0
Re: Last Power State
« Reply #1 on: February 13, 2010, 09:23:27 AM »
Certain UPS's will completely shut down and then return power after power comes back to the mains, however...

What you are after is only possible with certian serial UPS's and is not possible with a USB UPS.

See http://bugs.contribs.org/show_bug.cgi?id=2594 for more detail.
In life, you must either "Push, Pull or Get out of the way!"

Offline Brave Dave

  • *
  • 185
  • +0/-0
Re: Last Power State
« Reply #2 on: February 13, 2010, 08:56:13 PM »
Thanks for you reply

The last thing to get run is /sbin/halt.local

I've:
  • changed the SHUTDOWNCMD to reboot
  • in /sbin/halt.local - which didn't exist by default - put a sleep 300 line
  • and of course set the BIOS to last power state


Haven't been able to verify yet, but am fairly confident it will do the trick - and not have the adverse affect that changing the GRUB timeout would have
.:DB:.