blob: 2baffea27d861d8bc62e24a5c7b59776e1710aeb (
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
|
#!/usr/bin/env bash
#
# BorgBackup
#
if [ ! -d ~/UTCLOUD/ ]; then
red "$HOME/UTCLOUD not attached. Backup not started."
exit 1
fi
if [ ! -d ~/archive/ ]; then
yellow "$HOME/archive/ folder doesn't exist. Downloading latest version from ~/UTCLOUD/archive/ into ~/archive/."
rsync --verbose --progress --stats --update --recursive ~/UTCLOUD/archive/ ~/archive
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}"
yellow "Creating backup of notmuch data"
notmuch dump --output=$HOME/mbsync/notmuch-dump.txt
green "Done"
yellow "Creating new borg archive entry"
borg create \
--verbose \
--stats \
--progress \
--compression lzma,6 \
~/borgbackup::"{hostname}-{now}-${BACKUP_TAG}" \
~/ownCloud/ \
~/Nextcloud/ \
~/mbsync/ \
~/archive/
# add folders to be backed up here
green "Done"
yellow "Syncing ~/archive to ~/UTCLOUD/archive"
rsync --verbose --progress --stats --update --recursive ~/archive/ ~/UTCLOUD/archive/
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"
#
# mr
#
yellow "Backing up git repos"
pushd ~/ || 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"
|