blob: af61d7e77b995195b94aef2ed284afc516967038 (
plain) (
blame)
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
|
#!/bin/sh
set -eu
backup_includes=/etc/restic/includes
backup_excludes=/etc/restic/excludes
backup_tag=foobar
backup_keep=1m
main() {
# remove stale locks
resticw unlock
# run backup
resticw backup \
--one-file-system \
--files-from "${backup_includes}" \
--exclude-file "${backup_excludes}" \
--tag "${backup_tag}"
# prune backups older than $backup_keep duration
resticw forget \
--keep-within "${backup_keep}" \
--prune \
--group-by "paths,tags" \
--tag "${backup_tag}"
# TODO: restic check
# TODO: dump stats to file in metrics format to /run/prom/restic
}
exit_hook() {
resticw unlock
}
trap exit_hook INT EXIT
main
|