Historic archive of defunct list bismark-commits@lists.bufferbloat.net
 help / color / mirror / Atom feed
From: walter@svn.comics.unina.it
To: bismark-commits@lists.bufferbloat.net
Subject: [Bismark-commits] rev 352 - trunk/server/scripts
Date: Fri, 27 May 2011 08:05:25 +0200	[thread overview]
Message-ID: <E1QPqAn-0002dK-62@svn.comics.unina.it> (raw)

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:"


                 reply	other threads:[~2011-05-27  7:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1QPqAn-0002dK-62@svn.comics.unina.it \
    --to=walter@svn.comics.unina.it \
    --cc=bismark-commits@lists.bufferbloat.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox