-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathborg_lin.sh
More file actions
executable file
·46 lines (32 loc) · 941 Bytes
/
borg_lin.sh
File metadata and controls
executable file
·46 lines (32 loc) · 941 Bytes
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
#!/usr/bin/env bash
# Loosely based on https://nuxx.net/files/backupscripts/borgbackup.sh.txt
set -eu
source ~/.borg-lin
# Example command
# borg create --stats /run/media/joachim/lin/borg/phantom::{hostname}-{now:%Y-%m-%dT%H:%M:%S.%f} ~/Documents ~/.config ~/src ~/Downloads
# Initialize the backup; not needed for routine work.
# $BORG_EXEC init --encryption=repokey-blake2
echo "Beginning borg create"
# Do the backup.
$BORG_EXEC \
create \
--stats \
--progress \
--exclude-from $BORG_EXCLUDE_FILE \
--compression zstd,10 \
::{hostname}-{now:%Y-%m-%dT%H:%M:%S} \
~
echo "Running borg create"
echo "Completed borg create"
echo "Beginning borg prune"
# Clean up the old backups.
$BORG_EXEC \
prune \
--stats \
--list \
--keep-daily=7 \
--keep-weekly=4 \
--keep-monthly=1
echo "Running borg prune"
echo "Completed borg prune"
echo "Backup Complete"