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 mount ${project}:${bucket} ${mountpoint}/ --daemon --allow-other --dir-cache-time 24h
|
||||||
rclone mkdir ${mirror}:${mirrorbucket}
|
rclone mkdir ${mirror}:${mirrorbucket}
|
||||||
[[ ${oktorun} -ne 0 ]] && duplicity --full-if-older-than 1M --asynchronous-upload --tempdir /mnt --archive-dir /mnt \
|
duplicity --full-if-older-than 1M --asynchronous-upload --tempdir /mnt --archive-dir /mnt \
|
||||||
--no-encryption ${mountpoint} rclone://${mirror}:/${mirrorbucket} && \
|
--no-encryption ${mountpoint} rclone://${mirror}:/${mirrorbucket}
|
||||||
[[ -n "${extra_backup_jobs[${customer}]}" ]] && [[ -f ${extra_backup_jobs[${customer} ]] && ${extra_backup_jobs[${customer}]}
|
if [[ -n "${extra_backup_jobs[${customer}]}" ]] && [[ -f ${extra_backup_jobs[${customer} ]]; then
|
||||||
|
${extra_backup_jobs[${customer}]}
|
||||||
|
fi
|
||||||
umount ${mountpoint}
|
umount ${mountpoint}
|
||||||
rmdir ${mountpoint}
|
rmdir ${mountpoint}
|
||||||
# Clean up
|
# Clean up
|
||||||
[ ${oktorun} -ne 0 ] && duplicity remove-all-but-n-full ${number_of_full_to_keep} --tempdir /mnt --archive-dir /mnt \
|
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