Skip to content

Instantly share code, notes, and snippets.

@peterwilli
Created August 24, 2016 16:08
Show Gist options
  • Save peterwilli/6093ef6650b1d594874f20992d74eb38 to your computer and use it in GitHub Desktop.
Save peterwilli/6093ef6650b1d594874f20992d74eb38 to your computer and use it in GitHub Desktop.
Backup list of folders via rsync
#!/bin/bash
server="ssh.codebuffet.co" # This can (must :)) be your own domain / ip
dest=~peter/BackupStorage/rsync/daily
declare -a folders=("/var/www" "/root" "/var/lib/mysql")
## now loop through the above array
for i in "${folders[@]}"
do
echo "Backing up: '$i'..."
mkdir -p "$dest$i"
rsync -zave ssh "root@$server:$i/" "$dest$i"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment