fix script backup for new version duplicity

This commit is contained in:
2023-02-27 22:31:21 +01:00
parent 85f7573262
commit 767c45eb30
4 changed files with 38 additions and 34 deletions

View File

@@ -10,7 +10,7 @@ log () {
rotate_log() {
cat ${LOGFILE_RECENT} >> ${LOGFILE}
backupScw=`echo ${URL_SCW} | rev | cut -d "/" -f 2 | rev`
backupScw=`echo ${SCW_BUCKET} | rev | cut -d "/" -f 2 | rev`
status="OK"
if [ $(grep "Errors 0" ${LOGFILE_RECENT} |wc -l) -eq 0 ]; then
status="ALERTE FAIL !!!"
@@ -35,15 +35,17 @@ if [ $currently_backuping -eq 0 ]; then
source "$1"
echo > ${LOGFILE_RECENT}
log ">>> removing old backups"
${DUPLICITY} remove-older-than ${KEEP_BACKUP_TIME} ${URL_SCW} --force >> ${LOGFILE_RECENT} 2>&1
${DUPLICITY} remove-older-than --s3-endpoint-url ${SCW_ENDPOINT_URL} --s3-region-name ${SCW_REGION} ${KEEP_BACKUP_TIME} ${SCW_BUCKET} --force >> ${LOGFILE_RECENT} 2>&1
log ">>> creating and uploading backup to c14 cold storage ${SOURCE}"
${DUPLICITY} \
incr --full-if-older-than ${FULL_BACKUP_TIME} \
--s3-endpoint-url ${SCW_ENDPOINT_URL} \
--s3-region-name ${SCW_REGION} \
--asynchronous-upload \
--s3-use-glacier \
--encrypt-key=${GPG_FINGERPRINT} \
--sign-key=${GPG_FINGERPRINT} \
${SOURCE} ${URL_SCW} >> ${LOGFILE_RECENT} 2>&1
${SOURCE} ${SCW_BUCKET} >> ${LOGFILE_RECENT} 2>&1
rotate_log
else
log ">>> Duplicity déjà en cours de route sur cette utilisateur ${USER}"

View File

@@ -1,6 +1,8 @@
export AWS_ACCESS_KEY_ID="{{ aws_access_key_id }}"
export AWS_SECRET_ACCESS_KEY="{{ aws_secret_access_key }}"
export URL_SCW="s3://{{ url_scw }}/{{ scw_directory }}"
export SCW_REGION="{{ scw_region }}"
export SCW_ENDPOINT_URL="https://s3.${SCW_REGION}.scw.cloud"
export SCW_BUCKET="s3://{{ scw_directory }}"
# GPG Key information
export PASSPHRASE="{{ passphrase }}"