From 70111f64e5e348d7fbbef94f650c86a441de5fa4 Mon Sep 17 00:00:00 2001 From: Christopher Liu Date: Wed, 24 Jul 2019 16:22:18 -0700 Subject: [PATCH] Include logic for hoorays and fix log location --- scripts/pagerduty.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/pagerduty.sh b/scripts/pagerduty.sh index 27d786768..924a9c92b 100644 --- a/scripts/pagerduty.sh +++ b/scripts/pagerduty.sh @@ -26,16 +26,16 @@ RESOLVE="\ JSON_HEADER="Content-Type: application/json" POSTURL="https://events.pagerduty.com/v2/enqueue" -# Bingo check constants +# Validation check constants if [[ -f "triggered" ]] then triggered=$(< triggered) else triggered=false fi -lastbingo=$(tail -n 1000 latest/*.log | tac | grep -ai -m 1 bingo) -bingotime=$(echo $lastbingo | cut -f 2 -d 'r' | cut -c 16-34 | tr T \ ) -latest=$(date -d "$bingotime" +%s) +validation=$(tail -n 1000 $LOGFILE | tac | grep -ai -m 1 "bingo\|hooray") +timestamp=$(echo $validation | cut -f 3 -d 't' | cut -c 4-22 | tr T \ ) +latest=$(date -d "$timestamp" +%s) curtime=$(date +%s) delay=60 @@ -54,4 +54,4 @@ if [[ $(($curtime - $latest)) -gt $delay ]] triggered=false fi fi -echo "$triggered" > triggered \ No newline at end of file +echo "$triggered" > triggered