We help IT Professionals succeed at work.

UPS Script - Shutdown server

richard_h
richard_h asked
on
Medium Priority
503 Views
Last Modified: 2010-04-20
Hi,

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

Scenario

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.

Richard
Comment
Watch Question

Top Expert 2006
Commented:
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

Check:

man shutdown

for more info.

HTH:)



In order to cancel the shutdown if the power comes back on,

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

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
Commented:
Most linux distros have a UPS daemon available and if not a bunch can be downloaded and configured
http://www.roseindia.net/linux/tutorial/linux-howto/UPS-HOWTO/x73.html
http://www.sibbald.com/apcupsd/3.8manual/apcupsd.pdf

Just do a search on google for ups and linux

Author

Commented:
Will give it a bash if it works will award points

Richard
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.