Created
August 24, 2016 16:08
-
-
Save peterwilli/6093ef6650b1d594874f20992d74eb38 to your computer and use it in GitHub Desktop.
Backup list of folders via rsync
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
#!/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