From b8e7de704694bbcbdd58338704832e50c216dcdc Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 22 Mar 2023 15:53:35 +0000 Subject: catch update errors --- watcher.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'watcher.sh') diff --git a/watcher.sh b/watcher.sh index 6de246fb..b12ee1cb 100755 --- a/watcher.sh +++ b/watcher.sh @@ -12,11 +12,12 @@ do accts=$(curl -s https://coinos.io/api/balances | jr '.total') gap=$(node -pe "$accts - $total") echo $(date -Is) lnc $lnc lnw $lnw bc $bc tot $total gap $gap - # low=$(node -pe "!!($gap > $threshold)") - # if "$low"; then - # echo "Threshold hit, setting new threshold" - # pnpm pm2 stop 0 > /dev/null - # node /root/mailgun/index.js - # fi - sleep 60 + low=$(node -pe "!!($gap > $threshold)") + + if "$low"; then + echo "Threshold hit, setting new threshold" + docker stop app; + curl localhost:3119/email -H "content-type: application/json" -d '{"token": "MPJzfq97ab!!!!", "message": "threshold hit"}' + fi + sleep 120 done -- cgit v1.2.3