-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·48 lines (40 loc) · 1.36 KB
/
start.sh
File metadata and controls
executable file
·48 lines (40 loc) · 1.36 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
#!/bin/bash
THIS_DIR=`pwd`
TOMCAT_DIR="${THIS_DIR}/`ls | grep '^apache-tomcat-'`"
TOMCAT_LOG="${TOMCAT_DIR}/logs/catalina.out"
TAIL=`which gtail || which tail`
$TAIL --version | grep 'GNU' >/dev/null || die "Could not find GNU Tail";
ls ${TOMCAT_DIR}/webapps/riscoss && rm ${TOMCAT_DIR}/webapps/riscoss;
ls ${TOMCAT_DIR}/webapps/riscoss-rdr && rm ${TOMCAT_DIR}/webapps/riscoss-rdr;
echo $THIS_DIR
ln -s $THIS_DIR/riscoss-platform-rdr-war-*-SNAPSHOT ${TOMCAT_DIR}/webapps/riscoss-rdr
ln -s $THIS_DIR/riscoss-platform-dm-war-*-SNAPSHOT ${TOMCAT_DIR}/webapps/riscoss
#export CATALINA_OUT="/dev/stdout"
export CATALINA_OPTS="\
-Xmx1024m \
-XX:MaxPermSize=256m \
-Dxwiki.data.dir="$THIS_DIR/xwiki.data"
"
$TOMCAT_DIR/bin/catalina.sh jpda run 1>>$TOMCAT_LOG 2>>$TOMCAT_LOG &
JAVA_PID=$!
(
killjava() {
kill $JAVA_PID;
sleep 10;
kill -9 $JAVA_PID;
return 0;
}
ctr=0
while :; do
ctr=$(($ctr+1))
[ $ctr -gt 20 ] && killjava && exit 1;
curl --user superadmin:system \
'http://localhost:8080/riscoss/bin/preview/Sandbox/TestInit?content=works&xpage=plain' \
2>/dev/null | grep '<p>works</p>' && break;
sleep 1;
done
) &
PID=$!
$TAIL -F $TOMCAT_LOG --pid=$PID;
kill -0 $JAVA_PID && echo 'Tomcat started in the background' && exit 0;
echo 'Tomcat failed to start' && exit 1;