Last active
December 23, 2015 14:32
-
-
Save ironicbadger/bc8da95280a4e8324308 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
#!/bin/bash | |
rsync=/usr/bin/rsync | |
ssh=/usr/bin/ssh | |
sshkey=/home/alex/.ssh/id_rsa.pub | |
omega_user=root | |
omega_host=omega | |
omega_backup_path=/volume1/omega/backups | |
epsilon_storage=/mnt/storage | |
# backup paths | |
declare -a backup_from_epsilon_root=("/opt/appdata") | |
declare -a backup_from_storage=("photos" \ | |
"backups/btSyncDad" \ | |
"backups/btSyncMum" \ | |
"music/classical" \ | |
"music/flac" \ | |
"backups/dashcam" \ | |
"backups/appdata.backup") | |
# backup from / paths to /mnt/storage | |
for item in "${backup_from_epsilon_root[@]}" | |
do | |
if [[ $item == "/opt/appdata" ]]; then | |
$rsync -avzP \ | |
--delete \ | |
--exclude=/opt/appdata/nzbget/downloads \ | |
$item \ | |
$epsilon_storage/backups/appdata.backup | |
fi | |
done | |
# backup to omega from /mnt/storage | |
for item in "${backup_from_storage[@]}" | |
do | |
fullpath="$epsilon_storage/$item" | |
if [[ $item == *"backups/"* ]]; then | |
item="${item##*/}" | |
fi | |
$rsync -avzP -e $ssh -i $sshkey $fullpath/ $omega_user@$omega_host:$omega_backup_path/$item/ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment