-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunLocal.sh
106 lines (91 loc) · 2.11 KB
/
runLocal.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
99
100
101
102
103
104
105
106
#!/bin/bash
runCommand=$1
singleModuleName=$2
if [[ -z $runCommand ]] ; then
echo "usage: run.sh start | stop | restart"
echo " or: run.sh up | down | reload [moduleName]"
exit 1
fi
runFirstModules=("mdfDiscovery")
modules=("mdfCoreSystem" "mdfCustomer" "mdfLoanAndDeposit" "mdfSecurity" "mdfTransfer" "mdfWebAppBackend")
VERSION='0.0.1-SNAPSHOT'
function run {
local name=$1[@]
local modulesArr=("${!name}")
for module in ${modulesArr[@]}
do
echo "# Start module $module"
cd ../$module
./gradlew build
mkdir -p ../mdfBank/build/$module
cp build/libs/$module-$VERSION.jar ../mdfBank/build/$module/$module-$VERSION.jar
cd ../mdfBank/build/$module
java -jar $module-$VERSION.jar 2>&1 > /dev/null &
echo $!>pid.pid
cd ../../
done
}
function stop {
local name=$1[@]
local modulesArr=("${!name}")
for module in ${modulesArr[@]}
do
echo "# Stop module $module"
local pid="$(cat build/$module/pid.pid)"
kill $pid
done
}
function downModule {
local module=$1
echo "# down module $module"
local pid="$(cat build/$module/pid.pid)"
kill $pid
}
function upModule {
local module=$1
echo "# up module $module"
cd ../$module
./gradlew build
mkdir -p ../mdfBank/build/$module
cp build/libs/$module-$VERSION.jar ../mdfBank/build/$module/$module-$VERSION.jar
cd ../mdfBank/build/$module
java -jar $module-$VERSION.jar 2>&1 > /dev/null &
echo $!>pid.pid
cd ../../
}
if [ "$runCommand" == "start" ] ; then
echo "start"
# run first
run runFirstModules
echo "# running first modules ... waiting 20 sec."
sleep 20
#run others
run modules
fi
if [ "$runCommand" == "stop" ] ; then
echo "# stop"
stop modules
stop runFirstModules
fi
if [ "$runCommand" == "restart" ] ; then
echo "# stop"
stop modules
stop runFirstModules
echo "start"
# run first
run runFirstModules
echo "# running first modules ... waiting 20 sec."
sleep 20
#run others
run modules
fi
if [ "$runCommand" == "down" ] ; then
downModule $singleModuleName
fi
if [ "$runCommand" == "up" ] ; then
upModule $singleModuleName
fi
if [ "$runCommand" == "reload" ] ; then
downModule $singleModuleName
upModule $singleModuleName
fi