From 640921722a04908a15ded0989eb5fd5b0bf5e5a1 Mon Sep 17 00:00:00 2001 From: paradizelost Date: Thu, 29 Jun 2017 18:48:12 -0500 Subject: [PATCH] Fixed reconnect logic --- logwatch.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/logwatch.sh b/logwatch.sh index 6f53ed2..5506c1c 100644 --- a/logwatch.sh +++ b/logwatch.sh @@ -37,6 +37,16 @@ function procaplog(){ fi /root/bin/sheet.py "$date" $HOSTNAME ;; + ALLI_S7) + if [ $SENDALERT -eq 1 ]; then + echo "Alerting Dan" + echo "Alerting Dan" >> /var/log/logwatch.log + alert_dan "Alli is home at $date" + else + echo "Not alerting, Reconnection of $HOSTNAME" >> /var/log/logwatch.log + fi + /root/bin/sheet.py "$date" $HOSTNAME + ;; *) echo "No Match with -$HOSTNAME- alerting" echo "No Match with -$HOSTNAME- alerting">> /var/log/logwatch.log @@ -56,7 +66,7 @@ function procaplog(){ }; function checkdisconnects(){ THISCHECK=$(date -d "$1" +%s) - if [ "$(tail -n 30 "$LOG2" "$LOG" | grep "$(date +"%b %e")" | grep "$2" | grep "disassociated")" ]; then + if [ "$(tail -n 30 "$LOG2" "$LOG" | grep "$(date +"%b %e")" | grep "$2" | grep "disassociated" |wc -l)" -gt 0 ]; then echo 0 else echo 1