There's probably a better solution to this problem. But you could get by with this:
NEWMSG=echo "$BBALPHAMSG" | sed 's/<!--[^>]*>//'
MSG="$FROM\n$TO\n$SUBJECT\n\n\n\n$NEWMSG\n"
J On 02/10/2014 1:24 AM, "usa ims via Xymon" <xymon at xymon.com> wrote:
Xymon mailing list Xymon at xymon.com http://lists.xymon.com/mailman/listinfo/xymon
---------- Forwarded message ---------- From: usa ims <usaims at yahoo.com> To: xymon at xymon.com Cc: Date: Wed, 1 Oct 2014 08:19:03 -0700 Subject: removing <!-- [flags:ordAstLe] > from custom email script Hi,
My boss didn't like the subject line of the default email alerts and he asked me to change it.
I found a script online that does it -- so I modified the script and the subject line is doing what is expected but the body of the email is displaying some text that I would like not to be displayed.
How can I remove the " red [965282] red <!-- [flags:ordAstLe] >" or more importantly "<!-- [flags:ordAstLe] >"?
Here is the script:
#!/bin/bash
SM="/usr/sbin/sendmail" DATE=
date +%Y%m%d-%H%M%SFROM="From: Xymon Server <xxxxxx at xxxxxx.com>" TO="To:xxxxx at txxxxxx.com"if [ "$RECOVERED" = "1" ]; then RECOVERED="(Recovered)" else RECOVERED="" fiSUBJECT="Subject: D0 BIG BROTHER ALERT - $BBSVCNAME test on $BBHOSTNAME"
MSG="$FROM\n$TO\n$SUBJECT\n\n\n\n$BBALPHAMSG\n"
echo -e "$MSG" | $SM -t #####################################################
On a 'conn' test, it is displaying:
xxxxxxx.corp.local:conn red [965282] red <!-- [flags:ordAstLe] --> Wed Oct 1 10:46:24 2014 conn NOT ok
Service conn on xxxxxxx.corp.local is not OK : Host does not respond to ping
System unreachable for 20 poll periods (5386 seconds)
&red 5.5.5.5 is unreachable
###################################################
Is there anyway to remove that? Thanks in advance.
usaims