consider this update from the previous code snippet:
=====================================
filter_header ()
{
egrep -v "^To:|^From
|^Return-Path|^X-Original|^Delivered-To|^Received|^id|^MIME|^User-Agent|^Date:|^Content|^Message-Id|^From:|active
bounce corrupt"
}
filter_msg ()
{
egrep -v "^\*\*\*\*\* Nagios"|sed -e "s/Notification Type: //"|sed -e
'/^$/d'
}
reading_input ()
{
while read line
do
echo $line
done
}
filter_last ()
{
while read line
do
if [ "$line" = "PROBLEM" ] || [ "$line" = "RECOVERY" ] ; then
echo -n "$line on "
else
echo $line
fi
done
}
DEST=$1
if [ -z "$DEST" ]; then
printf "Destination: "
read DEST
fi
FILE_MSG=`mktemp /var/spool/sms/outgoing/send_XXXXXX`
echo "To: $DEST" > $FILE_MSG
echo "" >> $FILE_MSG
read line # this is required for using the script from cmd line otherwise
the list of directory listings will append to the original document.
reading_input | filter_header|filter_msg|filter_last >> $FILE_MSG
=====================================================
finally, got it running correctly. the goal here is simple define necessary
directives at nagios, define the proper aliases a postfix, then edit the
sendsms script wrapper that invokes sms3 daemon.
this is a rather painstaking procedure, granting that the original code
scrip is as follows:
DEST=$1
TEXT=$2
if [ -z "$DEST" ]; then
printf "Destination: "
read DEST
fi
if [ -z "$TEXT" ]; then
printf "Text: "
read TEXT
fi
FILE=`mktemp /var/spool/sms/outgoing/send_XXXXXX`
echo "To: $DEST" >> $FILE
echo "" >> $FILE
echo -n "$TEXT" >> $FILE
=========================================================
pretty simple and straighforward, however if you are using it just to fire
up sms3 to send sms messages this code works fine.
cheers!
--
Ronald Allan V. Tomimbang
Unix / Linux Admin
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
[email protected] (#PLUG @ irc.free.net.ph)
Read the Guidelines: http://linux.org.ph/lists
Searchable Archives: http://archives.free.net.ph