-
Notifications
You must be signed in to change notification settings - Fork 3
/
run
executable file
·49 lines (39 loc) · 1.28 KB
/
run
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
#!/bin/sh
#java options, necessary or too much memory
export _JAVA_OPTIONS="-Xms64m -Xmx512m -Xss2m -XX:MaxPermSize=256m"
APPNAME="helloworld"
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
echo "Starting Chordtrane"
DESTINATIONPATH="$SCRIPTPATH/builds"
PIDPATH="$DESTINATIONPATH/pidNumber"
echo "Stopping running instances if necessary"
if [ -f $PIDPATH ];
then
echo "Stopping instance"
PIDTOSTOP=$(cat $PIDPATH)
echo $PIDTOSTOP
kill $PIDTOSTOP
fi
BUILDRELPATH="/target/universal"
BUILDPATH=$SCRIPTPATH$BUILDRELPATH
echo $BUILDPATH
#Find most recent build zip file
ZIPFILE=$(ls "$BUILDPATH" | sort -r | grep .zip| head -1)
echo $ZIPFILE
ZIPFILEPATH="$BUILDPATH/$ZIPFILE"
unzip -o $ZIPFILEPATH -d $DESTINATIONPATH
ZIPFILENAME=${ZIPFILE%.zip}
echo $ZIPFILENAME
EXECPATH="$DESTINATIONPATH/$ZIPFILENAME/bin/$APPNAME"
echo $EXECPATH
$EXECPATH -DapplyEvolutions.default=true -DapplyDownEvolutions.default=true &
sleep 5
#touch "$DESTINATIONPATH/pidNumber"
PID=$(cat "$DESTINATIONPATH/$ZIPFILENAME/RUNNING_PID")
echo "PID number $PID"
echo $PID > "$PIDPATH"
#For redirecitng 80 to 9000
#/sbin/iptables -t nat -F
#/sbin/iptables -t nat -A OUTPUT -d localhost -p tcp --dport 80 -j REDIRECT --to-ports 9000
#/sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 9000