aboutsummaryrefslogtreecommitdiffstats
path: root/watcher.sh
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-02-21 23:01:37 +0000
committerAdam Soltys <[email protected]>2023-02-21 23:01:59 +0000
commit983e49a004b9ade1a90ee40d10c557ca7a6fe31e (patch)
tree2897619298048743c2d4a0f7dc504ade15348790 /watcher.sh
parenta311401e50cbc70f5d613097607cb55466aa4061 (diff)
downloadcoinos-server-983e49a004b9ade1a90ee40d10c557ca7a6fe31e.tar.gz
coinos-server-983e49a004b9ade1a90ee40d10c557ca7a6fe31e.zip
skip 2fa for admin login
Diffstat (limited to 'watcher.sh')
-rwxr-xr-xwatcher.sh22
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