Skip to content

Instantly share code, notes, and snippets.

@skwp
Created October 26, 2018 18:30
Show Gist options
  • Save skwp/53da48d7cdc24c5debf61579eea5108d to your computer and use it in GitHub Desktop.
Save skwp/53da48d7cdc24c5debf61579eea5108d to your computer and use it in GitHub Desktop.
#!/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