-
Notifications
You must be signed in to change notification settings - Fork 0
/
zedbak
executable file
·49 lines (45 loc) · 1.16 KB
/
zedbak
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
#!/bin/bash
if [[ $EUID -eq 0 ]]; then
echo "Don't run me as root"
exit
fi
if [ ! -b /dev/disk/by-partlabel/backup ]; then
echo "Backup drive not connected"
exit
fi
case "$1" in
"open")
sudo cryptsetup open /dev/disk/by-partlabel/backup backup
sudo zpool import backup
;;
"close")
sudo zpool export backup
sudo cryptsetup close backup
;;
"rsync")
if [ -e /dev/disk/by-uuid/67b8a324-6891-4d3a-a76c-bf814b0ecff1 ]; then
rsync -Pa --delete --delete-excluded \
--exclude=media/movies \
--exclude=media/tv \
--exclude=working/android/sdk \
--exclude=misc/androidsdk \
--exclude=misc/vr \
--exclude="media/anime/*/\[HorribleSubs\]*" \
--exclude="media/anime/*/*/\[HorribleSubs\]*" \
--exclude=media/torrent \
--exclude=backups/borg \
/mnt/zed/ /mnt/backup/
else
rsync -Pa --delete --delete-excluded \
--exclude=media/movies \
--exclude=media/tv \
--exclude=working/android/sdk \
--exclude=misc/androidsdk \
--exclude=misc/vr \
--exclude="media/anime/*/\[HorribleSubs\]*" \
--exclude="media/anime/*/*/\[HorribleSubs\]*" \
--exclude=media/torrent \
/mnt/zed/ /mnt/backup/
fi
;;
esac