#!/bin/bash
sats=100000000
threshold=$1
while true
do
f=/home/adam/coinos-server/data/funds/$(date +"%m-%d-%y-%T").json
docker exec -it cl lightning-cli listfunds > $f
lnc=$(cat $f | jr '[.channels[] | select(.state == "CHANNELD_NORMAL") | .channel_sat] | add')
lnw=$(cat $f | 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"
# docker stop app;
curl localhost:3119/email -H "content-type: application/json" -d '{"token": "MPJzfq97ab!!!!", "message": "threshold hit"}'
fi
sleep 120
done
blob: 91fcc5c1320a6d844483534a33394c792f3dc850 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
@tailwind base;
@tailwind components;
@tailwind utilities;
@font-face {
font-family: 'PublicSans';
src: url('/fonts/Public_Sans/static/PublicSans-Regular.ttf') format('truetype');
}
html {
font-family: PublicSans, sans-serif;
}
::selection {
color: black;
background: #eaf2ff;
}
|