diff --git a/templates/script/backup-all-buckets.erb.sh b/templates/script/backup-all-buckets.erb.sh index 853b772..c5179df 100644 --- a/templates/script/backup-all-buckets.erb.sh +++ b/templates/script/backup-all-buckets.erb.sh @@ -6,7 +6,9 @@ sleep $((16#$(ip a | grep "link/ether" | head -1 | awk -F ':' '{print $6}' | awk number_of_full_to_keep='<%= @full_backup_retention %>' fork_limit=30 #in GB, if bigger than this number, we fork the backup to it's own process customer="<%= @customer %>" +environment="<%= @environment %>" declare -A extra_backup_jobs + #<% if @extra_backup_jobs.any? %> #<% @extra_backup_jobs.each do |client, job| %> extra_backup_jobs["<%= client %>"]="<%= job %>" @@ -51,7 +53,7 @@ function do_backup { rclone mkdir ${mirror}:${mirrorbucket} duplicity --full-if-older-than 1M --asynchronous-upload --tempdir /mnt --archive-dir /mnt --no-encryption ${mountpoint} rclone://${mirror}:/${mirrorbucket} if [[ "${extra_backup_jobs[${customer}]:+found}" == "found" ]] && [[ -f "${extra_backup_jobs[${customer}]}" ]]; then - ${extra_backup_jobs[${customer}]} + ${extra_backup_jobs[${customer}]} ${project} ${mirror} ${bucket} ${customer} ${environment} fi umount ${mountpoint} rmdir ${mountpoint} diff --git a/templates/script/backup-hb.erb.sh b/templates/script/backup-hb.erb.sh index 706b589..93cf169 100755 --- a/templates/script/backup-hb.erb.sh +++ b/templates/script/backup-hb.erb.sh @@ -1,6 +1,8 @@ #!/bin/bash -environ="prod" -if [[ $(hostname -d) == "drive.test.sunet.se" ]]; then - environ="test" -fi -rsync -e "ssh -i ${HOME}/.ssh/id_script" -avz /opt/backupmounts/ "sd-${environ}@sd-${environ}-backup.hb.se:~/sd-${environ}" +project="${1}" +mirror="${2}" +bucket="${3}" +customer="${4}" +environment="${5}" + +rsync -e "ssh -i ${HOME}/.ssh/id_script" -avz "/opt/backupmounts/${bucket}" "sd-${environment}@sd-${environment}-backup.hb.se:~/sd-${environment}/${bucket}"