-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
backup.sh
executable file
·98 lines (85 loc) · 1.79 KB
/
backup.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
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
92
93
94
95
96
97
98
#!/bin/bash
#First the database backups on the remote server
SOURCE=/mnt/HC_Volume_4113275
DEST=backups
OBJECTIVE=$2
REMOVE_FILE=$3
shopt -s nocasematch
if [ -z "$OBJECTIVE" ]
then
OBJECTIVE='DOWNLOAD'
elif [[ $OBJECTIVE == 'upload' ]]; then
#statements
OBJECTIVE='UPLOAD'
TEMP=$SOURCE
SOURCE=$DEST
DEST=$TEMP
else
OBJECTIVE='DOWNLOAD'
fi
if [[ $REMOVE_FILE == 'True' ]]; then
REMOVE_FILE='-e'
else
REMOVE_FILE=''
fi
shopt -u nocasematch
echo 'Source :' $SOURCE
echo 'Destination :' $DEST
echo 'Objective :' $OBJECTIVE
lftp -u kartoza, sftp://plugins.qgis.org -e "mirror $REMOVE_FILE $SOURCE $DEST; bye"
#Next the plugin backups on the remote server
SOURCE=/mnt/HC_Volume_4113256/packages
DEST=static
OBJECTIVE=$2
REMOVE_FILE=$3
shopt -s nocasematch
if [ -z "$OBJECTIVE" ]
then
OBJECTIVE='DOWNLOAD'
elif [[ $OBJECTIVE == 'upload' ]]; then
#statements
OBJECTIVE='UPLOAD'
TEMP=$SOURCE
SOURCE=$DEST
DEST=$TEMP
else
OBJECTIVE='DOWNLOAD'
fi
if [[ $REMOVE_FILE == 'True' ]]; then
REMOVE_FILE='-e'
else
REMOVE_FILE=''
fi
shopt -u nocasematch
echo 'Source :' $SOURCE
echo 'Destination :' $DEST
echo 'Objective :' $OBJECTIVE
lftp -u kartoza, sftp://plugins.qgis.org -e "mirror $REMOVE_FILE $SOURCE $DEST; bye"
#Next the style backups on the remote server
SOURCE=/mnt/HC_Volume_4113256/styles
DEST=styles
OBJECTIVE=$2
REMOVE_FILE=$3
shopt -s nocasematch
if [ -z "$OBJECTIVE" ]
then
OBJECTIVE='DOWNLOAD'
elif [[ $OBJECTIVE == 'upload' ]]; then
#statements
OBJECTIVE='UPLOAD'
TEMP=$SOURCE
SOURCE=$DEST
DEST=$TEMP
else
OBJECTIVE='DOWNLOAD'
fi
if [[ $REMOVE_FILE == 'True' ]]; then
REMOVE_FILE='-e'
else
REMOVE_FILE=''
fi
shopt -u nocasematch
echo 'Source :' $SOURCE
echo 'Destination :' $DEST
echo 'Objective :' $OBJECTIVE
lftp -u kartoza, sftp://plugins.qgis.org -e "mirror $REMOVE_FILE $SOURCE $DEST; bye"