JBAS-947 SIP monthly login counts reporter
authorBill Erickson <berickxx@gmail.com>
Wed, 6 Jan 2016 16:42:52 +0000 (11:42 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Generate monthly sip login counts and email.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
KCLS/log-scripts/sip-login-counts-monthly.sh [new file with mode: 0644]

diff --git a/KCLS/log-scripts/sip-login-counts-monthly.sh b/KCLS/log-scripts/sip-login-counts-monthly.sh
new file mode 100644 (file)
index 0000000..3e9a020
--- /dev/null
@@ -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.
+