* [Bismark-commits] rev 352 - trunk/server/scripts
@ 2011-05-27 6:05 walter
0 siblings, 0 replies; only message in thread
From: walter @ 2011-05-27 6:05 UTC (permalink / raw)
To: bismark-commits
Author: walter
Date: 2011-05-27 08:05:25 +0200 (Fri, 27 May 2011)
New Revision: 352
Modified:
trunk/server/scripts/bdm
Log:
bdm: aggregate offline notifications every 12 hours
Modified: trunk/server/scripts/bdm
===================================================================
--- trunk/server/scripts/bdm 2011-05-26 19:01:18 UTC (rev 351)
+++ trunk/server/scripts/bdm 2011-05-27 06:05:25 UTC (rev 352)
@@ -343,6 +343,8 @@
# $2 = message
function sendmail ()
{
+ [ ${2:0:1} == "@" ] && msg=$(cat ${2:1}) || msg=$2
+
/usr/sbin/sendmail -t <<-end
From: "Bismark Device Manager" <do-not-reply@gtnoise.net>
To: "Walter" <walter.dedonato@unina.it>, "Brian" <bpoole@cc.gatech.edu>, "Srikanth" <srikanth@gatech.edu>
@@ -350,7 +352,7 @@
Date: $(date -R)
Content-type: text/plain
- $2
+ $msg
-- BDM
end
@@ -558,12 +560,13 @@
elif [ $off_time -lt 600 ]; then
echo -ne $YELLOW
else
- [ "$1" -a $off_time -lt 900 ] && sendmail $id "Device $id went offline"
+ [ "$1" -a $off_time -lt 900 ] && echo "$(date +"%Y-%m-%d %H:%M:%S") - Device $id went offline" >> /tmp/devices.log
echo -ne $RED
fi
# [ $(mysql -NB -u root -e "SELECT deviceid FROM DEVICES WHERE deviceid='$id'" $MYSQL_DB) ] || printf "#"
printf "%-16s %-15s %-7s %-20s %-10s\n" $id $ip $ver $(date -d @$ts +"%Y-%m-%d %H:%M:%S") $user
done
+ [ "$1" == "notify" ] && ( sendmail "@/tmp/devices.log" ; rm /tmp/devices.log )
# Dump tunnels table
echo -e "${BLUE}\nTunnels:"
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-05-27 7:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-27 6:05 [Bismark-commits] rev 352 - trunk/server/scripts walter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox