From 6d4bb233c35215055245faee701bfce13cfb7898 Mon Sep 17 00:00:00 2001 From: Corrado Mulas Date: Fri, 8 Apr 2022 23:58:04 +0000 Subject: [PATCH] Aggiungi 'glacier-backup' Bash script for backing up data to Glacier with Duplicity and GPG encryption --- glacier-backup | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 glacier-backup diff --git a/glacier-backup b/glacier-backup new file mode 100644 index 0000000..ccf25c6 --- /dev/null +++ b/glacier-backup @@ -0,0 +1,24 @@ +#!/bin/bash +source .rgs3-configrc + +currently_backuping=$(ps -ef | grep duplicity | grep python | wc -l) + +if [ $currently_backuping -eq 0 ]; then + # Clear the recent log file + cat /dev/null > ${LOGFILE_RECENT} + + log ">>> removing old backups" + duplicity remove-older-than ${KEEP_BACKUP_TIME} ${GS3_BUCKET} >> ${LOGFILE_RECENT} 2>&1 + + log ">>> creating and uploading backup to S3 Glacier storage" + duplicity \ + incr --full-if-older-than ${FULL_BACKUP_TIME} \ + --asynchronous-upload \ + --archive-dir /dir/duplicity/cache/duplicity \ + --s3-use-glacier \ + --encrypt-key=${GPG_FINGERPRINT} \ + --sign-key=${GPG_FINGERPRINT} \ + ${SOURCE} ${GS3_BUCKET} >> ${LOGFILE_RECENT} 2>&1 + + cat ${LOGFILE_RECENT} >> ${LOGFILE} +fi