forked from DougEdey/SB_Elsinore_Server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
launch.sh
executable file
·80 lines (72 loc) · 1.61 KB
/
launch.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
#!/bin/bash
echo "Starting Elsinore as $(whoami)"
ORIGINAL_USER="$(whoami)"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
JAVA="$(which java)"
usage()
{
cat << EOF
usage $0 options
This script is used to launch elsinore server. It will prompt for root if required
OPTIONS:
-h Show this message
-j Java Debug
-p <port> Port to run on
-g <file> GPIO Definitions File
-c <config> Config file (instead of elsinore.cfg)
-t <threshold> The amount to wait for an input to change before recording it.
-l <name> Set the default theme for elsinore.
-i Invert the outputs
-d Debug logging
EOF
$JAVA -jar $DIR/Elsinore.jar --help
}
JAVA_OPTS=
PORT=
CONFIG=$DIR/elsinore.cfg
GPIO=
DEBUG=
while getopts ":hjp:c:g:dt:l:i" OPTION
do
case $OPTION in
h)
usage
exit 1
;;
j)
JAVA_OPTS="$JAVAOPTS -agentlib:jdwp=transport=dt_socket,address=5050,server=y,suspend=y"
;;
p)
PORT="--port $OPTARG"
;;
c)
CONFIG=$OPTARG
;;
g)
GPIO="--gpio_definitions $OPTARG"
;;
d)
DEBUG="--d"
;;
t)
THRESHOLD="--rthreshold $OPTARG"
;;
l)
THEME="--theme $OPTARG"
;;
i)
JAVA_OPTS="$JAVAOPTS -Dinvert_outputs"
;;
?)
usage
exit
;;
esac
done
RUNTIME_OPTS="$PORT $GPIO $DEBUG $THRESHOLD $THEME --baseUser $ORIGINAL_USER"
RC=128
while [ $RC -eq 128 ]
do
sudo $JAVA $JAVA_OPTS -jar $DIR/Elsinore.jar --config $CONFIG $RUNTIME_OPTS
RC=$?
done