summaryrefslogtreecommitdiffstats
path: root/checkups.d/linode.sh
diff options
context:
space:
mode:
Diffstat (limited to 'checkups.d/linode.sh')
-rwxr-xr-xcheckups.d/linode.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/checkups.d/linode.sh b/checkups.d/linode.sh
new file mode 100755
index 0000000..5bc4fbe
--- /dev/null
+++ b/checkups.d/linode.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# This script is used by the CRON Daemon to check backups for consistency
+# and optionally integrity via the Restic backup utility
+
+
+# Load restic variables
+source /etc/restic.d/backblaze.conf
+
+# WARNING: Checking the backup integrity can be a costly procedure when using
+# cloud data storage. This is because in order to verify integrity we must
+# download the blobs and verify them. If the cloud storage provider charges
+# more for download than upload (e.g, Cold Storage Plan) this can rack up
+# expenses very quickly.
+#
+# Thankfully this does not need to be done very often BUT IT STILL NEEDS TO
+# BE DONE. You wouldn't want to have your backups not working when you
+# actually need to restore something would you? This does not normally need
+# to be done very often, but if you would rather have the checks
+# only perform consistency checking, not integrity checks you can remove
+# the '--read-data' from the command.
+
+# NOTE: When repositories get fairly large checking them can generate large
+# cache directories. It can also take a very long time to complete. Because
+# of this we split the operation into 255 parts that run individually.
+
+# Check backup repository consistency (and integrity if --read-data is used)
+counter=1
+while [ "$counter" -le 255 ] ; do
+ restic check \
+ "$RESTIC_COMMON_OPTS" \
+ --read-data-subset="$counter""/""255" \
+ --read-data
+ ((counter++))
+done