diff options
| author | Adam Soltys <[email protected]> | 2021-06-05 01:14:56 -0400 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-06-05 01:14:56 -0400 |
| commit | 421accbfbc0a1add93f7704e657ae93f2d836b82 (patch) | |
| tree | 16807bc65a82ca80c5878d81c1c8dd945e8fccc9 /watcher.sh | |
| parent | 3bdd16bb7a757f33587c9ef5834fa47c1ee00210 (diff) | |
| download | coinos-server-421accbfbc0a1add93f7704e657ae93f2d836b82.tar.gz coinos-server-421accbfbc0a1add93f7704e657ae93f2d836b82.zip | |
bump address indices
Diffstat (limited to 'watcher.sh')
| -rwxr-xr-x | watcher.sh | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -1,19 +1,20 @@ #!/bin/bash sats=100000000 +threshold=$1 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") + low=$(node -pe "$total < $threshold") 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 + echo "Threshold hit, setting new threshold" + threshold=$total + # yarn pm2 stop 0 > /dev/null + node /root/mailgun/index.js fi sleep 10 done |
