blob: b900a50c5bc6262437f0b7317c75d3813446ee1f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#!/bin/bash
sats=100000000
while true
do
ln=$(lncli --lnddir=/root/.lnda --network=mainnet --chain=bitcoin --rpcserver=localhost:10001 channelbalance | jr .balance)
bc=$(bitcoin-cli getbalance)
el=$(elements-cli getbalance | jr .bitcoin)
total=$(node -pe "$ln + $bc * $sats + $el * $sats")
low=$(node -pe "$total < $1")
echo $(date -Is) ln $ln bc $bc el $el tot $total
if "$low"; then
echo "Balance below threshold, shutting down"
yarn pm2 stop 0 > /dev/null
cd /root/mailgun && node index.js
exit
fi
sleep 10
done
|