From 6d60bbf200dadabb84cf35b9450001b30044ba35 Mon Sep 17 00:00:00 2001 From: camille Date: Fri, 30 Jun 2023 16:07:19 +0200 Subject: [PATCH] duplicity - add check script --- tasks/tools.yml | 8 ++++++++ templates/check_duplicity.sh.j2 | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 templates/check_duplicity.sh.j2 diff --git a/tasks/tools.yml b/tasks/tools.yml index 0274705..7a20009 100644 --- a/tasks/tools.yml +++ b/tasks/tools.yml @@ -6,3 +6,11 @@ owner: root group: root mode: 0640 + +- name: backup | add last backup check script + template: + src: check_duplicity.sh.j2 + dest: /usr/local/bin/check_duplicity.sh + owner: root + group: root + mode: 0750 diff --git a/templates/check_duplicity.sh.j2 b/templates/check_duplicity.sh.j2 new file mode 100644 index 0000000..adeb0aa --- /dev/null +++ b/templates/check_duplicity.sh.j2 @@ -0,0 +1,8 @@ +# Ansible generated +# Check if backup of the day is present +currenttime=$(date +%H:%M) +if [[ "$currenttime" > "09:00" ]] || [[ "$currenttime" < "23:59" ]]; then + source /etc/duplicity/duplicity.cnf && duplicity collection-status --name {{ duplicity_backup_name }} --archive-dir={{ duplicity_archive_dir }} "{{ duplicity_azure_path }}" |grep 'Full\|Incremental' |grep -i "$(date +"%a %b %d")" |wc -l +else + echo "1" +fi