-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyawls_cli.sh
executable file
·57 lines (48 loc) · 1.61 KB
/
yawls_cli.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
#!/bin/bash
#
# Author: Dominik Brämer <[email protected]>
#
# Please remove the "Author" lines above and replace them
# with your own name if you copy and modify this script.
#
# License GPLv3
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
export NO_AT_BRIDGE=1
NAME="yawls"
#Refresh symlink to OpenCV jar file
OPENCVJAR=$(ls /usr/share/OpenCV/java)
ln -sf "/usr/share/OpenCV/java/$OPENCVJAR" '/usr/share/yawls/opencv.jar' &>/dev/null
#Path to openjdk 7
JAVA="/usr/lib/jvm/java-7-openjdk-*/bin/java"
#Set Java optimal options
if [[ $(arch) == "x86_64" ]]; then
OPTIONS="-d64 -server -XX:+AggressiveOpts -Xmn10M -Xms25M -Xmx25M"
else
OPTIONS="-d32 -server -XX:+AggressiveOpts -Xmn10M -Xms25M -Xmx25M"
fi
#Start program
$JAVA $OPTIONS -jar '/usr/share/yawls/yawls.jar' $@ &
#Create pid file if not existing already
PID=$!
if [[ ! -f /var/run/$NAME.pid ]]; then
trap "rm -f /var/run/$NAME.pid &>/dev/null" 0 1 2 3 15
(echo $PID > /var/run/$NAME.pid) &>/dev/null
wait $PID
else
wait $PID
fi
EXIT_CODE=$?
# Handle SIGTERM/SIGINT correctly in daemon mode
if [[ $1 == "-d" || $1 == "--daemon" ]]; then
if [[ $EXIT_CODE == 143 || $EXIT_CODE == 130 ]]; then
exit 0
fi
fi