delete old rescue backups

This commit is contained in:
Christian Rotzoll
2019-04-16 13:22:29 +01:00
parent d9246bcd0b
commit 26fe1018a5
2 changed files with 31 additions and 3 deletions

View File

@@ -246,6 +246,23 @@ wordone,wordtweo,wordthree, ...
gotFile=0
while [ ${gotFile} -eq 0 ]
do
echo "**********************************"
echo "* UPLOAD THE channel.backup FILE *"
echo "**********************************"
echo "If you have a lnd-rescue backup file on your laptop you can now"
echo "upload it and restore the your latest LND state."
echo
echo "CAUTION: Dont restore old LND states - risk of loosing funds!"
echo
echo "To make upload open a new terminal on your laptop,"
echo "change into the directory where your lnd-rescue file is and"
echo "COPY, PASTE AND EXECUTE THE FOLLOWING COMMAND:"
echo "scp -r ./lnd-rescue-*.tar.gz admin@${localip}:/home/admin/"
echo ""
echo "Use password A to authenticate file transfere."
echo "PRESS ENTER when upload is done. Enter x & ENTER to cancel."
echo "Please upload file. Press ENTER to try again or (x & ENTER) to cancel:"
read key
echo "key(${key})"

View File

@@ -29,6 +29,9 @@ if [ ${mode} = "backup" ]; then
sudo tar -zcvf /home/admin/lnd-rescue.tar.gz /mnt/hdd/lnd
sudo chown admin:admin /home/admin/lnd-rescue.tar.gz
# delete old backups
rm /home/admin/lnd-rescue-*.tar.gz
# name with md5 checksum
md5checksum=$(md5sum /home/admin/lnd-rescue.tar.gz | head -n1 | cut -d " " -f1)
mv /home/admin/lnd-rescue.tar.gz /home/admin/lnd-rescue-${md5checksum}.tar.gz
@@ -58,6 +61,9 @@ elif [ ${mode} = "restore" ]; then
echo "*** LND.RESCUE --> RESTORE"
echo ""
# delete old backups
rm /home/admin/lnd-rescue-*.tar.gz
filename=""
while [ ${#filename} -eq 0 ]
do
@@ -77,13 +83,15 @@ elif [ ${mode} = "restore" ]; then
echo "scp -r ./lnd-rescue-*.tar.gz admin@${localip}:/home/admin/"
echo ""
echo "Use password A to authenticate file transfere."
echo "PRESS ENTER when upload is done. Use CTRL-C to abort."
echo "PRESS ENTER when upload is done. Enter x & ENTER to cancel."
fi
if [ ${countZips} -gt 1 ]; then
echo "!! WARNING !!"
echo "There are multiple lnd-rescue files in directory /home/admin."
echo "Make sure there is only one file to work with and start again."
echo "Make sure you upload only one tar.gz-file and start again."
echo
echo "PRESS ENTER to continue."
read key
exit 1
fi
if [ ${countZips} -eq 1 ]; then
@@ -111,9 +119,12 @@ elif [ ${mode} = "restore" ]; then
echo
echo "WARNING: This will delete/overwrite the LND state/funds of this RaspiBlitz."
echo
echo "PRESS ENTER to start restore. Use CTRL-C to abort."
echo "PRESS ENTER to start restore. Enter x & ENTER to cancel."
fi
read key
if [ "${key}" == "x" ]; then
exit 1
fi
done
# stop LND