|
|
|
@ -45,17 +45,19 @@ function do_backup {
|
|
|
|
|
local mountpoint="/opt/backupmounts/${bucket}"
|
|
|
|
|
ps aux | grep duplicity | grep "[^a-zA-Z]${bucket}" > /dev/null
|
|
|
|
|
local oktorun=$? # 1 == this bucket has no other bakup process in progress
|
|
|
|
|
if [[ ${oktorun} -ne 0 ]]; then
|
|
|
|
|
mkdir -p ${mountpoint}
|
|
|
|
|
[[ ${oktorun} -ne 0 ]] && rclone mount ${project}:${bucket} ${mountpoint}/ --daemon --allow-other --dir-cache-time 24h
|
|
|
|
|
rclone mount ${project}:${bucket} ${mountpoint}/ --daemon --allow-other --dir-cache-time 24h
|
|
|
|
|
rclone mkdir ${mirror}:${mirrorbucket}
|
|
|
|
|
[[ ${oktorun} -ne 0 ]] && duplicity --full-if-older-than 1M --asynchronous-upload --tempdir /mnt --archive-dir /mnt \
|
|
|
|
|
--no-encryption ${mountpoint} rclone://${mirror}:/${mirrorbucket} && \
|
|
|
|
|
[[ -n "${extra_backup_jobs[${customer}]}" ]] && [[ -f ${extra_backup_jobs[${customer} ]] && ${extra_backup_jobs[${customer}]}
|
|
|
|
|
duplicity --full-if-older-than 1M --asynchronous-upload --tempdir /mnt --archive-dir /mnt --no-encryption ${mountpoint} rclone://${mirror}:/${mirrorbucket}
|
|
|
|
|
if [[ "${extra_backup_jobs[${customer}]:+none}" != "none" ]] && [[ -f "${extra_backup_jobs[${customer}]}" ]]; then
|
|
|
|
|
${extra_backup_jobs[${customer}]}
|
|
|
|
|
fi
|
|
|
|
|
umount ${mountpoint}
|
|
|
|
|
rmdir ${mountpoint}
|
|
|
|
|
# Clean up
|
|
|
|
|
[ ${oktorun} -ne 0 ] && duplicity remove-all-but-n-full ${number_of_full_to_keep} --tempdir /mnt --archive-dir /mnt \
|
|
|
|
|
--force rclone://${mirror}:/${mirrorbucket}
|
|
|
|
|
duplicity remove-all-but-n-full ${number_of_full_to_keep} --tempdir /mnt --archive-dir /mnt --force rclone://${mirror}:/${mirrorbucket}
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for entry in "${projects[@]}"; do
|
|
|
|
|