-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathbackup-qgis.org.sh
63 lines (60 loc) · 1.31 KB
/
backup-qgis.org.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
#!/bin/bash
# The first time before running this script, connect once manually to
# accept the ssh key:
# sftp sftp://changelog.qgis.org:2222
#First the database backups on the remote server
SOURCE=ftp/db
DEST=backups/db
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://changelog.qgis.org:2222 -e "mirror $REMOVE_FILE $SOURCE $DEST; bye"
#Next the media backups on the remote server
SOURCE=ftp/media
DEST=backups/media
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://changelog.qgis.org:2222 -e "mirror $REMOVE_FILE $SOURCE $DEST; bye"