Aggiungi 'glacier-backup'

Bash script for backing up data to Glacier with Duplicity and GPG encryption
This commit is contained in:
2022-04-08 23:58:04 +00:00
parent 3954c1cbe4
commit 6d4bb233c3

24
glacier-backup Normal file
View File

@@ -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