diff options
| author | John Barratt <[email protected]> | 2023-02-28 13:55:59 -0800 |
|---|---|---|
| committer | John Barratt <[email protected]> | 2023-02-28 13:55:59 -0800 |
| commit | e47d50a443f0a396321716a506e1df325dd4a1fb (patch) | |
| tree | 1c010c5970e9cbfbf8671e6f00a97d6518446fdd /watcher.sh | |
| parent | 58e996a4ac227162f171e84530fe898cb504e045 (diff) | |
| parent | e4702b4d13e4d966d735c2ba4657e10d7c436a57 (diff) | |
| download | coinos-server-e47d50a443f0a396321716a506e1df325dd4a1fb.tar.gz coinos-server-e47d50a443f0a396321716a506e1df325dd4a1fb.zip | |
Merge branch 'master' of https://github.com/coinos/coinos-server into notifications
Diffstat (limited to 'watcher.sh')
| -rwxr-xr-x | watcher.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/watcher.sh b/watcher.sh new file mode 100755 index 00000000..6de246fb --- /dev/null +++ b/watcher.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +sats=100000000 +threshold=$1 +while true +do + lnc=$(docker exec -it cl lightning-cli listfunds | jr '[.channels[] | .channel_sat] | add') + lnw=$(docker exec -it cl lightning-cli listfunds | jr '[.outputs[] | .value] | add') + ln=$(node -pe "$lnc + $lnw") + bc=$(docker exec -it bc bitcoin-cli getbalance | jr) + total=$(node -pe "$ln + $bc * $sats") + 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 +done |
