mynode/rootfs/standard/usr/bin/wait_on_lnd.sh

19 lines
520 B
Bash
Raw Normal View History

2019-06-15 23:02:44 +00:00
#!/bin/bash
2021-03-09 03:55:39 +00:00
source /usr/share/mynode/mynode_config.sh
NETWORK=mainnet
if [ -f $IS_TESTNET_ENABLED_FILE ]; then
NETWORK=testnet
fi
2019-06-15 23:02:44 +00:00
# Wait until lnd is synced
echo "Checking if LND is synced..."
2021-03-09 03:55:39 +00:00
lncli --network=$NETWORK --lnddir /mnt/hdd/mynode/lnd getinfo | grep 'synced_to_chain": true'
2021-11-19 20:35:01 +00:00
while [ $? -ne 0 ]; do
2019-06-15 23:02:44 +00:00
echo "LND not synced, sleeping for 60 seconds..."
/bin/sleep 60s
2021-03-09 03:55:39 +00:00
lncli --network=$NETWORK --lnddir /mnt/hdd/mynode/lnd getinfo | grep 'synced_to_chain": true'
2019-06-15 23:02:44 +00:00
done
2021-11-19 20:35:01 +00:00
echo "LND is ready."
2019-06-15 23:02:44 +00:00
exit 0