-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsave_valuable
More file actions
executable file
·44 lines (35 loc) · 1.26 KB
/
save_valuable
File metadata and controls
executable file
·44 lines (35 loc) · 1.26 KB
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
#!/usr/bin/env bash
params="First parameter should be -l for long(on server) or -q for quick(on /stockage/ or -u for usb (/mnt/dd/save_pc_fixe/))"
if [ $# -ne 2 ]
then
echo $params
echo "Second parameter is the commit name (ex : 13-11-2020)"
exit 1
fi
if [ "$1" != "-l" ] && [ "$1" != "-q" ] && [ "$1" != "-u" ]
then
echo $params
exit 1
fi
# borg init -e repokey /path/to/repo
export BORG_SERVER_REPO="ssh://dionisos@192.168.1.48:22/home/dionisos/save_portable"
export BORG_DD_REPO="/stockage/borg_save"
export BORG_USB_DD_REPO="/mnt/dd/save_pc_fixe"
to_save="/home/dionisos/scripts/files_to_save"
to_exclude="/home/dionisos/scripts/files_to_exclude"
echo "Parameters ok."
if [ "$1" == "-l" ]
then
echo "Save in $BORG_SERVER_REPO::$2"
doas -u root borg create --stats --progress "$BORG_SERVER_REPO"::"$2" $(cat $to_save) --exclude-caches --exclude-from $to_exclude
fi
if [ "$1" == "-q" ]
then
echo "Save in $BORG_DD_REPO::$2"
doas -u root borg create --stats --progress "$BORG_DD_REPO"::"$2" $(cat $to_save) --exclude-caches --exclude-from $to_exclude
fi
if [ "$1" == "-u" ]
then
echo "Save in $BORG_USB_DD_REPO::$2"
doas -u root borg create --stats --progress "$BORG_USB_DD_REPO"::"$2" $(cat $to_save) --exclude-caches --exclude-from $to_exclude
fi