Skip to content

Instantly share code, notes, and snippets.

@substack

substack/backup

Last active Mar 12, 2016
Embed
What would you like to do?
backup and restore settings
#!/bin/bash
SERVER=yourwebsite.com
tar -cjf- ~/.crypt/passwd ~/.ssh ~/.bashrc ~/.profile ~/.vimrc ~/.gitconfig \
~/.config/chromium ~/.mozilla \
| openssl enc -aes-256-cbc \
| ssh $SERVER 'cat>~/www/backup/`date +%F.%T`'
ssh $SERVER 'ls -1 ~/www/backup | grep ^[0-9] | sort > ~/www/backup/list.txt'
#!/bin/bash
WEB=http://yourwebsite.com/whatever
f=`curl -s $WEB/list.txt | tail -n1`
d=restore-`date +%F.%T`
mkdir $d
curl -s "$WEB/$f" \
| openssl enc -d -aes-256-cbc \
| tar -C "$d" -xjf-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.