[SATLUG] APC UPS daemon

dondavis at reglue.org dondavis at reglue.org
Wed Jul 7 10:25:59 CDT 2010


I briefly mentioned getting an email to my cellphone when the power goes
off (or comes back on). In the /etc/apcupsd directory there are a few
scripts for what happens when the power goes off and when the power comes
back on.
For an email to your cell phone you just have to know the sms gateway for
your provider.

Knowing this you can change the script to text you:

#!/bin/sh
#
# This shell script if placed in /etc/apcupsd
# will be called by /etc/apcupsd/apccontrol when the UPS
# goes on batteries.
# We send an email message to root to notify him.
#
SYSADMIN=me at reglue.org
MOBILE=5128675309 at vtext.com
APCUPSD_MAIL="mail"

HOSTNAME=`hostname`
MSG="$HOSTNAME Power Failure !!!"
#
(
   echo "Subject: $MSG"
   echo " "
   echo "$MSG"
   echo " "
   /sbin/apcaccess status
) | $APCUPSD_MAIL -s "$MSG" $SYSADMIN $MOBILE
exit 0


You can set the time interval in the conf file so that you don't get
texted every time there's a quick brown out.




More information about the SATLUG mailing list