| #!/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