Compare commits
No commits in common. "adeaea5a3799b45d7ed0a699a8ba8a21afdab998" and "6e5831367eec92e8646d8a347d4b652dfb4cd690" have entirely different histories.
adeaea5a37
...
6e5831367e
|
@ -45,19 +45,17 @@ function do_backup {
|
||||||
local mountpoint="/opt/backupmounts/${bucket}"
|
local mountpoint="/opt/backupmounts/${bucket}"
|
||||||
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
|
||||||
if [[ ${oktorun} -ne 0 ]]; then
|
|
||||||
mkdir -p ${mountpoint}
|
mkdir -p ${mountpoint}
|
||||||
rclone mount ${project}:${bucket} ${mountpoint}/ --daemon --allow-other --dir-cache-time 24h
|
[[ ${oktorun} -ne 0 ]] && rclone mount ${project}:${bucket} ${mountpoint}/ --daemon --allow-other --dir-cache-time 24h
|
||||||
rclone mkdir ${mirror}:${mirrorbucket}
|
rclone mkdir ${mirror}:${mirrorbucket}
|
||||||
duplicity --full-if-older-than 1M --asynchronous-upload --tempdir /mnt --archive-dir /mnt --no-encryption ${mountpoint} rclone://${mirror}:/${mirrorbucket}
|
[[ ${oktorun} -ne 0 ]] && duplicity --full-if-older-than 1M --asynchronous-upload --tempdir /mnt --archive-dir /mnt \
|
||||||
if [[ "${extra_backup_jobs[${customer}]:+none}" != "none" ]] && [[ -f "${extra_backup_jobs[${customer}]}" ]]; then
|
--no-encryption ${mountpoint} rclone://${mirror}:/${mirrorbucket} && \
|
||||||
${extra_backup_jobs[${customer}]}
|
[[ -n "${extra_backup_jobs[${customer}]}" ]] && [[ -f ${extra_backup_jobs[${customer} ]] && ${extra_backup_jobs[${customer}]}
|
||||||
fi
|
|
||||||
umount ${mountpoint}
|
umount ${mountpoint}
|
||||||
rmdir ${mountpoint}
|
rmdir ${mountpoint}
|
||||||
# Clean up
|
# Clean up
|
||||||
duplicity remove-all-but-n-full ${number_of_full_to_keep} --tempdir /mnt --archive-dir /mnt --force rclone://${mirror}:/${mirrorbucket}
|
[ ${oktorun} -ne 0 ] && duplicity remove-all-but-n-full ${number_of_full_to_keep} --tempdir /mnt --archive-dir /mnt \
|
||||||
fi
|
--force rclone://${mirror}:/${mirrorbucket}
|
||||||
}
|
}
|
||||||
|
|
||||||
for entry in "${projects[@]}"; do
|
for entry in "${projects[@]}"; do
|
||||||
|
|
|
@ -25,7 +25,7 @@ dirty=0
|
||||||
primary=''
|
primary=''
|
||||||
declare -a users=( 'admin' )
|
declare -a users=( 'admin' )
|
||||||
cd "${tempdir}" || echo "Could not cd to tempdir"
|
cd "${tempdir}" || echo "Could not cd to tempdir"
|
||||||
declare -a projects=( $("${yq}" -r '.project_mapping.'"${customer}"'.'"${environment}"'.assigned | "\(.[].project)"' /etc/hiera/data/common.yaml) )
|
declare -a projects=( "${yq}" -r '.project_mapping.'"${customer}"'.'"${environment}"'.assigned | "\(.[].project)"' /etc/hiera/data/common.yaml )
|
||||||
if [[ "${include_userbuckets}" == "true" ]]; then
|
if [[ "${include_userbuckets}" == "true" ]]; then
|
||||||
primary=$("${yq}" -r '.project_mapping.'"${customer}"'.'"${environment}"'.primary_project' /etc/hiera/data/common.yaml)
|
primary=$("${yq}" -r '.project_mapping.'"${customer}"'.'"${environment}"'.primary_project' /etc/hiera/data/common.yaml)
|
||||||
projects+=( "${primary}" )
|
projects+=( "${primary}" )
|
||||||
|
|
Loading…
Reference in a new issue