forked from Apereo-Learning-Analytics-Initiative/OpenLRW
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·121 lines (109 loc) · 6.06 KB
/
run.sh
File metadata and controls
executable file
·121 lines (109 loc) · 6.06 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/sh
##################
# GUI #
##################
function splash {
printf "\033c"
echo "
____ __ ___ _ __
/ __ \___ ___ ___ / / / _ \ | /| / /
/ /_/ / _ \/ -_) _ \/ /__/ , _/ |/ |/ /
\____/ .__/\__/_//_/____/_/|_||__/|__/
/_/
──────────────────── Standards-focused Learning Records Warehouse "
}
function alert_usage {
echo "
╭────────────────────────────────────────────────────────────────╮
│ OpenLRW │ \033[31mERROR MESSAGE\033[0m ░▒▓▓▓▓│
├────────────────────────────────────────────────────────────────│
│ Wrong argument try these instead: start, stop, deploy │
╰────────────────────────────────────────────────────────────────╯"
}
function alert_error_start {
echo "
╭────────────────────────────────────────────────────────────────╮
│ OpenLRW │ \033[31mERROR MESSAGE\033[0m ░▒▓▓▓▓│
├────────────────────────────────────────────────────────────────│
│ Can't start, an instance is already running! stop it first \033[31m✘\033[0m │
╰────────────────────────────────────────────────────────────────╯"
}
function alert_start {
echo "
╭────────────────────────────────────────────────────────────────╮
│ OpenLRW │ \033[36mINFORMATION\033[0m ░▒▓▓▓▓│
├────────────────────────────────────────────────────────────────│
│ Starting OpenLRW \033[32m✓\033[0m │
╰────────────────────────────────────────────────────────────────╯
"
}
function alert_error_stop {
echo "
╭────────────────────────────────────────────────────────────────╮
│ OpenLRW │ \033[31mERROR MESSAGE\033[0m ░▒▓▓▓▓│
├────────────────────────────────────────────────────────────────│
│ Cannot stop, OpenLRW was not running! \033[31m✘\033[0m │
╰────────────────────────────────────────────────────────────────╯"
}
function alert_stop {
echo "
╭────────────────────────────────────────────────────────────────╮
│ OpenLRW │ \033[36mINFORMATION\033[0m ░▒▓▓▓▓│
├────────────────────────────────────────────────────────────────│
│ Shutting down OpenLRW \033[32m✓\033[0m │
╰────────────────────────────────────────────────────────────────╯
"
}
function alert_deploy {
echo "
╭────────────────────────────────────────────────────────────────╮
│ OpenLRW │ \033[36mINFORMATION\033[0m ░▒▓▓▓▓│
├────────────────────────────────────────────────────────────────│
│ Deploying OpenLRW (Build + Run) \033[32m✓\033[0m │
╰────────────────────────────────────────────────────────────────╯
"
}
######## SCRIPT ##########
function start {
if [ -f $PID_FILE ]; then
alert_error_start
exit 1
fi
alert_start
java \
-Djava.io.tmpdir=/tmp/openlrw \
-Dserver.port=9966 \
-Dspring.config.location=$SETTINGS_PATH \
-jar $JAR_PATH &
echo $! > $PID_FILE
}
splash
cd `dirname $0`
APP_HOME="$PWD"
PID_FILE=$APP_HOME/run/matthews.pid
JAR_PATH=$APP_HOME/lib/openlrw.jar
SETTINGS_PATH=$APP_HOME/conf/settings.properties
cd $APP_HOME
case "$1" in
"start")
start
;;
"deploy")
alert_deploy
sh build.sh
start
;;
"stop")
if [ ! -f $PID_FILE ]; then
alert_error_stop
exit 1
fi
alert_stop
kill `cat $PID_FILE`
rm -f $PID_FILE
;;
*)
alert_usage
;;
esac
exit 0