From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from svn.comics.unina.it (unknown [143.225.229.147]) by huchra.bufferbloat.net (Postfix) with ESMTP id 8A9AF200BCB for ; Fri, 27 May 2011 00:03:49 -0700 (PDT) Received: from www-data by svn.comics.unina.it with local (Exim 4.69) (envelope-from ) id 1QPqAn-0002dK-62 for bismark-commits@lists.bufferbloat.net; Fri, 27 May 2011 08:05:25 +0200 To: bismark-commits@lists.bufferbloat.net From: walter@svn.comics.unina.it Message-Id: Date: Fri, 27 May 2011 08:05:25 +0200 X-Mailman-Approved-At: Fri, 27 May 2011 09:25:59 -0700 Subject: [Bismark-commits] rev 352 - trunk/server/scripts X-BeenThere: bismark-commits@lists.bufferbloat.net X-Mailman-Version: 2.1.13 Precedence: list List-Id: Commit log for the bismark source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 May 2011 07:03:49 -0000 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" To: "Walter" , "Brian" , "Srikanth" @@ -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:"