Welcome! Log In Create A New Profile

Advanced

Dockstar - make it run commands when UPS says power low?

Posted by nigelhealy 
Dockstar - make it run commands when UPS says power low?
April 26, 2012 12:56AM
Hi, welcome from dirty-power California. My UPS protects my network-based equipment from brownouts average 3 times a day and whilst blackouts are rare, typically annually, I had an outage recently which ran long enough to flatten my UPS and the Debian Dockstar build on external USB stick was corrupted and I had to manually intervene, insert in a Linux laptop and do a fsck -t ext2 to repair the filesystem before the Dockstar would boot. Not good.

As a hack just now I did a tune2fs -c 0 to make it boot even if not cleanly shutdown, I can periodically do a fsck -t ext2 -y anyway manually periodically, but I'd prefer a graceful shutdown.

I plugged in the UPS vis USB and the dockstar recognized it, I don't have the dmesg messages to hand but it looked like it knew it was a UPS.

So my goal is to do 3 things:
- send outgoing mail, such as SMTP to gmail, to notify me remotely there is a power event
- send commands, such as SSH, to other systems to get them to gracefully shutdown. I'm thinking specifically the other Dockstar I have which would not be connected to the UPS via USB.
- finally shut itself down gracefully.

I know how to script, I know how to put commands in SSH and do the keygen thing so no passwords required. What I don't know how is to get the scripts triggered by specific status of the UPS. Its a APC make which is the most popular domestic UPS make.

I've done some searching and my needs are fairly simple, there is the Network UPS tools which seem a sledgehammer to crack a nut, is there something I can apt-get install in Debian which has simple battery-threshold commands?

Aside - one of my bootable USB sticks will ONLY cold boot, and another USB stick will ONLY warm boot. Cold boot is compatible with a power incident as it will be a cold boot when power is restored. Warm boot only is bad. I'll probably have to buy another 2GB USB and hope it cold boots.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: