Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a ups connected to a Linux server with a usb cable, i installed apcupsd demon and i was wondering how to instruct it to run a shell script i created when a special condition occurs? i.e. the battery is 25% percent or the time left is 10 minutes so this condition can run the script?

share|improve this question
up vote 1 down vote accepted

Solved by creating a custom shell script and place it under /ect/apcupsd with the exact name of doshutdown which is triggered when a configured condition is met (either the remaining time of the battery or the remaining percentage - both based on the ups calculations) , the script contains my desired actions and if it ends with exit 0 so the shut down sequence will continue by the apcups demon after the script finishes and make the script ends with exit 99 to makes the shell script actions the only responder when the configured conditions met.

share|improve this answer

You can try to alter the script /etc/apcupsd/appcontrol do perform the necessary actions.

See the apcupsd documentation.

share|improve this answer
Dear, Read the question again I'm asking for an example, i already been through the documents but i'm not sure which is which? – BluesRhythm Dec 18 '12 at 15:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.