blob: 739e94ccd77cb2c59e03c6186d6efd5678dd7a37 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
#!/usr/bin/env bash
set -Eeuo pipefail
#
# BorgBackup
#
if [ ! -d ~/UTCLOUD/ ]; then
red "$HOME/UTCLOUD not attached. Backup not started."
exit 1
fi
if [ ! -d ~/borgbackup/ ]; then
yellow "$HOME/borgbackup/ repository doesn't exist. Downloading latest version from ~/UTCLOUD/borg/borgbackup/ into ~/borgbackup/."
# The initial borg repo was created with:
# $ borg init --append-only --encryption=keyfile ~/borgbackup
# See also: https://borgbackup.readthedocs.io/en/stable/usage/notes.html#append-only-mode
rsync --verbose --progress --stats --update --recursive ~/UTCLOUD/borg/borgbackup/ ~/borgbackup
fi
BACKUP_TAG="${1-default}"
rm -rf "$HOME/tmp/backup/"
mkdir -p "$HOME/tmp/backup/"
yellow "Creating backup for newsboat data"
newsboat -E "$HOME/tmp/backup/newsboat.txt"
green "Done"
yellow "Creating backup of notmuch data"
notmuch dump --output="$HOME/tmp/backup/notmuch-dump.txt"
green "Done"
yellow "Creating new borg archive entry"
borg create \
--verbose \
--stats \
--progress \
--compression lzma,6 \
~/borgbackup::"{hostname}-{now}-${BACKUP_TAG}" \
~/Nextcloud/ \
~/mbsync/ \
~/archive/ \
~/tmp/backup/
# add folders to be backed up here
green "Done"
yellow "Committing borg config changes..."
pushd ~/dev/libre/borg/
git add .
git commit -m "JOB: automated update of borg config files after backup.sh"
git push origin master
popd
green "Done."
yellow "Syncing ~/borgbackup to ~/UTCLOUD/borg/borgbackup/"
rsync --verbose --progress --stats --update --recursive ~/borgbackup/ ~/UTCLOUD/borg/borgbackup/
green "Done"
yellow "Syncing ~/borgbackup to $R:borgbackup/"
rsync --verbose --progress --stats --update --recursive ~/borgbackup/ "$R:borgbackup/"
green "Done"
yellow "Syncing $R:vps-borgbackup/ ~/UTCLOUD/borg/vps-borgbackup/"
rsync --verbose --progress --stats --update --recursive "$R:vps-borgbackup/" ~/UTCLOUD/borg/vps-borgbackup/
green "Done"
#
# mr
#
yellow "Backing up ~/dev/libre/ git repos"
pushd ~/dev/libre/ || exit 1
mr -s master
mr -s status
mr -s -j16 update
mr -s hd
mr -s -j4 rsyncnet
popd || exit 1
yellow "Syncing annex"
pushd ~/annex/ || exit 1
git annex sync
popd || exit 1
green "Done"
|