UPS Script - Shutdown server

Posted on 2006-04-05
Last Modified: 2010-04-20

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.

Question by:richard_h
    LVL 22

    Assisted Solution

    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,

    Author Comment

    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
    LVL 1

    Accepted Solution

    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

    Author Comment

    Will give it a bash if it works will award points


    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
    I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension ( This reminded me of questions tha…
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now