-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·47 lines (37 loc) · 875 Bytes
/
run.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
#!/usr/bin/env bash
set -e
module_name="public-sentiment-model-server"
function show_usage() {
echo "usage: $0 [-p <profile>]"
}
function is_profile_valid() {
[[ $1 == "develop" ]] || [[ $1 == "testing" ]] || [[ $1 == "product" ]]
}
while getopts "p:" arg; do
case "$arg" in
p)
p="$OPTARG"
if ! is_profile_valid "$p"; then
echo "invalid profile: '$p'. profile must be one of 'develop', 'testing', 'product'"
exit 1
fi
profile="$p"
;;
*)
show_usage
exit 1
;;
esac
done
if [[ -d "./output" ]]; then
cd ./output
fi
if [ -n "$profile" ]; then
echo "run in $profile profile"
else
echo "profile is unset. run in product profile"
profile="product"
fi
run_command="nohup java -jar $module_name.jar --spring.profiles.active=$profile >> $module_name.log 2>&1 &"
echo "eval \"$run_command\""
eval "$run_command"