-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathborg-backup
executable file
·37 lines (26 loc) · 1.06 KB
/
borg-backup
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
#!/bin/bash
main () {
export BORG_PASSPHRASE=$(<~/BORG_PASSPHRASE)
export BORG_RSH="ssh -i ~/.ssh/borgbackup"
local readonly [email protected]:/mnt/ext_usb/borg-backup
local readonly N_TITLE="BORG"
local readonly N_ICON="disks"
echo "$PWD"
# notification
notify-send -t 5000 -i $N_ICON $N_TITLE "started at $(date +%H:%M)"
local OUTPUT=$(borg create --compression zlib,4 -v --stats $REPOSITORY::'{hostname}-{now:%Y-%m-%d}' \
/home/faebser/Documents/ \
/home/faebser/workspace/ \
/home/faebser/sync \
/home/faebser/Pictures /home/faebser/Books 2>&1)
echo "$OUTPUT"
echo "$OUTPUT" | grep -i "Duration" | xargs -0 notify-send -t 5000 -i $N_ICON $N_TITLE
# Use the `prune` subcommand to maintain 7 daily, 4 weekly and 6 monthly
# archives of THIS machine. The '{hostname}-' prefix is very important to
# limit prune's operation to this machine's archives and not apply to
# other machine's archives also.
borg prune -v --list $REPOSITORY --prefix '{hostname}-' \
--keep-daily=7 --keep-weekly=4 --keep-monthly=6
}
main