The FreeBSD Diary

The FreeBSD Diary (TM) Remember
I remember
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 Forwarding apcupsd events to 'other than root'
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.



Reply To This Message
 Forum List  |  Threaded View   Newer Topic  |  Older Topic 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org