-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
backup_restic.sh
executable file
·60 lines (56 loc) · 1.28 KB
/
backup_restic.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#! /usr/bin/env bash
function restic_backup() {
local directories=(
"/mnt/hdd1/[DATA]/SFX/SFX"
"/mnt/hdd2/[DATA]/Adobe PSD"
"/mnt/hdd1/[DATA]/Cloud Data"
"/mnt/hdd1/Pictures/Camera Roll/"
"/mnt/hdd1/Pictures/Saved Pictures/"
"/mnt/hdd1/Pictures/Saved Folders/Screenshots/"
"/mnt/hdd1/Pictures/Cloud Pictures/"
"/mnt/hdd1/Pictures/Wallpapers/"
"/mnt/hdd1/Documents/Cloud Documents/"
"/mnt/hdd1/Videos/Cloud Videos/"
"/mnt/hdd1/Music/"
"/home/dartegnian/SYGtech/icaras-interconnect/"
"/home/dartegnian/SYGtech/goteki-git/"
"/home/dartegnian/SYGtech/piranha-prototype/"
)
local tags=(
"Archives"
"PSDs"
"General Data HDD 1"
"Camera Roll"
"Saved Pictures"
"Screenshots"
"Pictures"
"Wallpapers"
"Documents"
"Videos"
"Music"
"SYG Icaras Backups"
"Git Clones"
"Production Sites"
)
echo "Backing up directories"
for i in "${!directories[@]}"; do
printf "\n\nBacking up directory ${directories[i]}\n"
restic backup "--tag=${tags[i]}" "${directories[i]}"
done
}
function restic_cleanup() {
local snapshot_amount="15"
restic forget --keep-last $snapshot_amount --prune
}
function main() {
if [[ $USER == "root" ]]; then
GOMAXPROCS=1
source /etc/restic-env
restic_backup
restic_cleanup
else
echo "Re-run as root."
exit 1
fi
}
main