-
Notifications
You must be signed in to change notification settings - Fork 0
/
transfer.sh
executable file
·54 lines (47 loc) · 1.44 KB
/
transfer.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
#!/usr/bin/env bash
declare -a specials=("beta.einfracentral.eu" "dl068.madgik.di.uoa.gr" "localhost" "dl068")
source=${1}
target=${2}
type=${3}
if [[ -z "$3" ]]; then
type=elastic
fi
force=1
for i in "${specials[@]}"; do
if [[ "$i" == "$target" ]] ; then
force=0
msg="WARNING: Sure you want to overwrite from ${source} to ${target}? (yes/no)"
./beep.sh "$msg"
read -p "$msg"
if [[ $REPLY = "yes" ]]; then
force=1
fi
fi
done
if [[ ${force} -eq 1 ]]; then
cd ../eic-data/exports/
stamp=$(date +%s)
sudo mv xmls xmls.${stamp}
if [[ "$type" == "elastic" ]]; then
mv elasticJasons elasticJasons.${stamp}
./elasticDumpJasons.sh ${source}
./elasticConvertJasonsToXmls.js
msg="WARNING: You're about to upload from ${source} to ${target}. Please say ok when you're done making manual changes."
./beep.sh "$msg"
read -p "$msg"
if [[ $REPLY = "ok" ]]; then
./elasticPostXmls.sh ${target}
fi
fi
if [[ "$type" == "core" ]]; then
mv jsons jsons.${stamp}
./coreDumpJasons.sh ${source}
./coreConvertJasonsToXmls.js
msg="WARNING: You're about to upload from ${source} to ${target}. Please say ok when you're done making manual changes."
./beep.sh "$msg"
read -p "$msg"
if [[ $REPLY = "ok" ]]; then
./corePostXmls.sh ${target}
fi
fi
fi