Clean up logic
This commit is contained in:
parent
6e5831367e
commit
3738e703b6
|
@ -46,16 +46,20 @@ function do_backup {
|
||||||
ps aux | grep duplicity | grep "[^a-zA-Z]${bucket}" > /dev/null
|
ps aux | grep duplicity | grep "[^a-zA-Z]${bucket}" > /dev/null
|
||||||
local oktorun=$? # 1 == this bucket has no other bakup process in progress
|
local oktorun=$? # 1 == this bucket has no other bakup process in progress
|
||||||
mkdir -p ${mountpoint}
|
mkdir -p ${mountpoint}
|
||||||
[[ ${oktorun} -ne 0 ]] && rclone mount ${project}:${bucket} ${mountpoint}/ --daemon --allow-other --dir-cache-time 24h
|
if [[ ${oktorun} -ne 0 ]]; then
|
||||||
rclone mkdir ${mirror}:${mirrorbucket}
|
rclone mount ${project}:${bucket} ${mountpoint}/ --daemon --allow-other --dir-cache-time 24h
|
||||||
[[ ${oktorun} -ne 0 ]] && duplicity --full-if-older-than 1M --asynchronous-upload --tempdir /mnt --archive-dir /mnt \
|
rclone mkdir ${mirror}:${mirrorbucket}
|
||||||
--no-encryption ${mountpoint} rclone://${mirror}:/${mirrorbucket} && \
|
duplicity --full-if-older-than 1M --asynchronous-upload --tempdir /mnt --archive-dir /mnt \
|
||||||
[[ -n "${extra_backup_jobs[${customer}]}" ]] && [[ -f ${extra_backup_jobs[${customer} ]] && ${extra_backup_jobs[${customer}]}
|
--no-encryption ${mountpoint} rclone://${mirror}:/${mirrorbucket}
|
||||||
umount ${mountpoint}
|
if [[ -n "${extra_backup_jobs[${customer}]}" ]] && [[ -f ${extra_backup_jobs[${customer} ]]; then
|
||||||
rmdir ${mountpoint}
|
${extra_backup_jobs[${customer}]}
|
||||||
# Clean up
|
fi
|
||||||
[ ${oktorun} -ne 0 ] && duplicity remove-all-but-n-full ${number_of_full_to_keep} --tempdir /mnt --archive-dir /mnt \
|
umount ${mountpoint}
|
||||||
|
rmdir ${mountpoint}
|
||||||
|
# Clean up
|
||||||
|
duplicity remove-all-but-n-full ${number_of_full_to_keep} --tempdir /mnt --archive-dir /mnt \
|
||||||
--force rclone://${mirror}:/${mirrorbucket}
|
--force rclone://${mirror}:/${mirrorbucket}
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
for entry in "${projects[@]}"; do
|
for entry in "${projects[@]}"; do
|
||||||
|
|
Loading…
Reference in a new issue