• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 486
  • Last Modified:

UPS Script - Shutdown server


Would like to know if there is some kind of script or app I could install on my Suse Linux 9.1 Ent server to do the following


Power failure occurs and UPS switches to battery backup,
Then sends signal via usb / serial to the server, Server picks up signal and initiates a shutdown sequence.

The area that this server is located at suffers from sever power outages for long periods of time.

  • 2
2 Solutions
Doesn't need to be much of a script really, just make sure that the signal triggers:

shutdown -h now

for immediate shutdown, or

shutdown -h -t 60

if you want a delay of 60 seconds before shutting down.

To ensure that all users are aware of the reason for the shutdown and the fact that it was going to happen, enter the following into the script:

wall "Server is commencing a shutdown in x minutes due to a power failure. Please save all work now!"

The message can be integrated into the shutdown command if required. To cancel a shutdown if the power comes back on you need:

shutdown -c


man shutdown

for more info.


In order to cancel the shutdown if the power comes back on,
richard_hAuthor Commented:
Not to worried if it goes down the user on site can boot it up then if need be.
Do you know of any software that could interpret the signal to the server?
ie to kick off the script
Most linux distros have a UPS daemon available and if not a bunch can be downloaded and configured

Just do a search on google for ups and linux
richard_hAuthor Commented:
Will give it a bash if it works will award points


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now