raspiblitz/home.admin/BBcloseAllChannels.sh

43 lines
1.2 KiB
Bash
Raw Normal View History

2018-08-08 17:36:04 +02:00
#!/bin/bash
# load raspiblitz config data (with backup from old config)
source /mnt/hdd/raspiblitz.conf 2>/dev/null
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#chain} -eq 0 ]; then
2018-12-04 00:51:17 +01:00
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
fi
# precheck: AutoPilot
2018-11-30 13:14:27 +01:00
if [ "${autoPilot}" = "on" ]; then
dialog --title 'Info' --msgbox 'You need to turn OFF the LND AutoPilot first,\nso that closed channels are not opening up again.\nYou find the AutoPilot -----> SERVICES section' 7 55
2018-11-30 13:14:27 +01:00
exit 1
fi
2018-12-20 20:11:02 +01:00
command="lncli --chain=${network} --network=${chain}net closeallchannels --force"
2018-08-08 17:36:04 +02:00
clear
echo "***********************************"
echo "Closing All Channels (EXPERIMENTAL)"
echo "***********************************"
echo ""
echo "COMMAND LINE: "
echo $command
echo ""
echo "RESULT:"
# PRECHECK) check if chain is in sync
2018-12-20 20:11:02 +01:00
chainInSync=$(lncli --chain=${network} --network=${chain}net getinfo | grep '"synced_to_chain": true' -c)
2018-08-08 17:36:04 +02:00
if [ ${chainInSync} -eq 0 ]; then
command=""
result="FAIL PRECHECK - lncli getinfo shows 'synced_to_chain': false - wait until chain is sync "
fi
# execute command
if [ ${#command} -gt 0 ]; then
2018-08-09 13:16:53 +02:00
${command}
2018-08-08 17:36:04 +02:00
fi
echo ""
2018-11-18 12:42:13 +01:00
echo "OK - please recheck if channels really closed"
2018-08-23 18:31:43 +02:00
sleep 5