blob: 4def7acdcc05985dc0c1e1fbf4e27b7ef452ba05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/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/linode.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"
((counter++))
done
|