Created
October 26, 2018 18:30
-
-
Save skwp/53da48d7cdc24c5debf61579eea5108d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
BUCKET=our.s3.bucket.com | |
FILE=$1 | |
if [[ ! -z "$FILE" ]]; then | |
/usr/local/bin/aws s3 cp s3://$BUCKET/bitcoin-backups/$FILE /tmp/restore.tgz | |
else | |
echo "File not specified, will restore backup we started with (assumed to be in /tmp/bitcoin.tgz)" | |
cp /tmp/bitcoin.tgz /tmp/restore.tgz | |
fi | |
# Save the peers | |
sudo cp /var/bitcoin/nol/peers.dat /tmp/peers.dat | |
sudo cp /var/bitcoin/nol/banlist.dat /tmp/banlist.dat | |
# Get rid of the old dir | |
sudo rm -r /var/bitcoin.old | |
sudo mv /var/bitcoin{,.old} | |
sudo tar xvf /tmp/restore.tgz -C / | |
# Bring them back | |
sudo cp /tmp/peers.dat /var/bitcoin/nol/peers.dat | |
sudo cp /tmp/banlist.dat /var/bitcoin/nol/banlist.dat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment