-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_backup.sh
executable file
·45 lines (35 loc) · 1.22 KB
/
run_backup.sh
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
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
PATH=/snap/bin:${PATH}
# Backblaze B2 configuration variables
source ${DIR}/restic-env.sh
echo
echo "##############################################"
echo "# Test connection to ${RESTIC_REPOSITORY}."
echo "##############################################"
restic snapshots || exit 1
echo "Connection established."
while read folder; do
echo
echo "##############################################"
echo "# Run backup for ${folder}"
echo "##############################################"
restic backup -o b2.connections=50 ${folder}
done < ${DIR}/backup-folders.txt
echo
echo "##############################################"
echo "# Remove old snapshots"
echo "##############################################"
restic forget --keep-daily 7 --keep-weekly 8 --keep-monthly 24 --prune
echo
echo "##############################################"
echo "# Check repository"
echo "##############################################"
restic check
echo
echo "##############################################"
echo "# List latest snapshots"
echo "##############################################"
restic snapshots --last
source ${DIR}/restic-env-unset.sh
echo "All done"