Compare commits

...

9 commits

Author SHA1 Message Date
Micke Nordin d30dabc534 Merge branch 'main' into stable 2024-06-27 09:34:31 +02:00
Micke Nordin d353069660 Make a standard about which params a script gets.
project="${1}"
mirror="${2}"
bucket="${3}"
customer="${4}"
environment="${5}"
2024-06-27 09:31:37 +02:00
Micke Nordin 4cf8cf3adb Add backup script for hb 2024-06-26 12:48:50 +02:00
Micke Nordin 7f7d38c87e Switch logic 2024-06-26 10:19:53 +02:00
Micke Nordin bac25d27c8 Fix bug in script 2024-06-26 09:58:18 +02:00
Micke Nordin 42831948e1 Fix syntax error 2024-06-26 09:40:36 +02:00
Micke Nordin db92a5d255 Clean up logic 2024-06-26 09:14:59 +02:00
Micke Nordin 1dea001ed9 No ports for mode host 2024-06-25 18:09:13 +02:00
Micke Nordin 4d6e6f67af Use correect variable 2024-06-25 11:19:53 +02:00
2 changed files with 10 additions and 6 deletions

View file

@ -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}

View file

@ -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}"