From 8edb4660002bc478f2a202eb64910cba0341098b Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 6 Jan 2016 11:42:52 -0500 Subject: [PATCH] JBAS-947 SIP monthly login counts reporter Generate monthly sip login counts and email. Signed-off-by: Bill Erickson --- KCLS/log-scripts/sip-login-counts-monthly.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 KCLS/log-scripts/sip-login-counts-monthly.sh diff --git a/KCLS/log-scripts/sip-login-counts-monthly.sh b/KCLS/log-scripts/sip-login-counts-monthly.sh new file mode 100644 index 0000000000..3e9a020ea9 --- /dev/null +++ b/KCLS/log-scripts/sip-login-counts-monthly.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Count the number of logins per SIP account for the previous month +# and email the output the to address(es) listed below. +EMAIL="lhill@kcls.org" +LOGINS=(lyndasip hooplasip2) + +DATE=$(date -d "-1 month" +'%m %Y'); +MONTH=$(echo $DATE | cut -d' ' -f1); +YEAR=$(echo $DATE | cut -d' ' -f2); + +FILE="/tmp/sip-logins-$YEAR-$MONTH.txt" + +for LOGIN in ${LOGINS[@]}; do + ./sip-login-counts.sh -l $LOGIN -y $YEAR -m $MONTH >> $FILE +done + +cat $FILE | mailx -s "SIP Login Counts $YEAR/$MONTH" $EMAIL + +# rm $FILE +# Leave file in place. it's tiny and may be useful. + -- 2.11.0