-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive.sh
executable file
·60 lines (48 loc) · 1.52 KB
/
archive.sh
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
#!/bin/bash
usage="
Usage: `basename $0` [options]
Move all content in the folder 'LEEF/3.archived.data' to the container 'LEEF.archived.data'
and copy the content of the folder 'LEEF/9.backend' to the container 'LEEF.backend'
on the S3 Swift Object Storage. The transfer uses the 'swift' command.
Options:
-h, --help Print short help message and exit
"
if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then
echo "${usage}"
exit 0
fi
############
############
FROM_ARCHIVED=/home/ubuntu/LEEF/3.archived.data
TO_ARCHIVE_CONTAINER=LEEF.archived.data
FROM_BACKEND=/home/ubuntu/LEEF/9.backend
TO_BACKEND_CONTAINER=LEEF.backend.data
echo
echo "FROM ARCHIVED : $FROM_ARCHIVED"
echo "TO CONTAINER : $TO_ARCHIVE_CONTAINER"
echo
echo "FROM BACKEND : $FROM_BACKEND"
echo "TO CONTAINER : $TO_BACKEND_CONTAINER"
echo
source /home/ubuntu/restic/swift;
echo "####################################";
echo "## uploading $FROM_ARCHIVED";
echo "####################################";
/home/ubuntu/.local/bin/swift upload \
--changed \
--skip-identical \
$TO_ARCHIVE_CONTAINER \
$FROM_ARCHIVED &&
sudo rm -rf $FROM_ARCHIVED;
echo "####################################";
echo "## uploading $FROM_BACKEND";
echo "####################################";
/home/ubuntu/.local/bin/swift upload \
--changed \
--skip-identical \
$TO_BACKEND_CONTAINER \
$FROM_BACKEND \
--object-name LEEF.RRD.$(date +%Y-%m-%d).sqlite &&
echo "####################################";
echo "## done";
echo "####################################";