Author: jhorne
Date: 01-01-07 02:25
when i configured my apcupsd, i saw the scripts are configured to send a message to root. i forward roots mail to my inbox, but:
1) i want the most important events to be forwarded to my cell phone as text message, and
2) i dont want to create any more sendmail aliases to include this person that person etc etc, just for the purpose of marshalling apc messages to appropriate places.
so, i made some small edits to some of the "event action" scripts located in /usr/local/etc/apcupsd/, as such:
#!/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=root
MOBILE=[mycellphonenumber]@vtext.com #<-- Create Alias for my cell phone address
APCUPSD_MAIL="/usr/bin/mail"
HOSTNAME=`hostname`
MSG="$HOSTNAME Power Failure !!!"
#
(
echo "Subject: $MSG"
echo " "
echo "$MSG"
echo " "
/usr/local/sbin/apcaccess status
) | $APCUPSD_MAIL -s "$MSG" $SYSADMIN $MOBILE #<-- Add my alias to recipients
exit 0
i edited commfailure, commok, onbattery, and offbattery in this way, and now i
get the most important events sent to my cell phone as well.
|
|