-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathphms-server.sh
executable file
·72 lines (57 loc) · 1.59 KB
/
phms-server.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
# usage:
# ./phms-server.sh start — starts the server from a bundled jar, if the jar doesn't exist it creates it
# ./phms-server.sh clean — starts the server from a newly created jar, deletes old jar
# ./phms-server.sh — default, same as start
#Basically, it just run two commands:
#sbt mkJar;
#./modules/apps/server/target/universal/stage/bin/phms-app-server
CMD_CLEAN='clean'
CMD_START='start'
#the name of the executable jar that is created using `sbt mkJar`
SBT_ARGS='mkJar'
SCRIPT_NAME='modules/apps/server/target/universal/stage/bin/phms-app-server'
RUNTIME_SETUP_SCRIPT='runtime-start.sh'
RUNTIME_STOP_SCRIPT='runtime-stop.sh'
warning() {
echo ""
echo "*********"
echo "[WARNING]: $1";
echo "*********"
echo ""
}
info() {
echo ""
echo "[INFO] $1"
echo ""
}
if (( $# == 0 ));
then
warning "-- no command line arguments specified. Defaulting to command: $CMD_START"
user_cmd="$CMD_START"
else
user_cmd="$1"
fi
if [ "$user_cmd" == "$CMD_START" ]
then
if [ -f $SCRIPT_NAME ]
then
info "executable already exists."
else
info "executable does not exist. creating using: 'sbt $SBT_ARGS'"
sbt $SBT_ARGS
fi #SCRIPT_NAME
info "starting up dockers ./$RUNTIME_SETUP_SCRIPT"
./$RUNTIME_SETUP_SCRIPT
info "running: './$SCRIPT_NAME'"
./$SCRIPT_NAME
elif [ "$user_cmd" == "$CMD_CLEAN" ]
then
info "clean + recreating jar: 'sbt mkJar'"
sbt mkJar
info "stopping dockers ./$RUNTIME_STOP_SCRIPT"
./$RUNTIME_STOP_SCRIPT
info "starting up dockers ./$RUNTIME_SETUP_SCRIPT"
./$RUNTIME_SETUP_SCRIPT
info "running: './$SCRIPT_NAME'"
./$SCRIPT_NAME
fi