Update ves-agent dependency
[vfc/nfvo/driver/ems.git] / ems / microservice-standalone / src / main / assembly / run.sh
1 #
2 # Copyright (C) 2015 CMCC, Inc. and others. All rights reserved. (CMCC)
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #         http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 #JAVA_HOME="/home/conductortest/jdk1.7/jdk/linux"
17
18 DIRNAME=`dirname $0`
19 RUNHOME=`cd $DIRNAME/; pwd`
20 export RUNHOME
21 echo @RUNHOME@ $RUNHOME
22 cd $RUNHOME
23 # JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
24 echo @JAVA_HOME@ $JAVA_HOME
25 JAVA="$JAVA_HOME/bin/java"
26 echo @JAVA@ $JAVA
27
28 JAVA_OPTS="-Xms50m -Xmx128m"
29
30 OSNAME=`uname`
31 if [ $OSNAME = "Linux" ]; then
32         PLATFORM=`uname -p`
33         if [ $PLATFORM = "x86_64" ] ;then
34                 if [ -d $JAVA_HOME/jre/lib/i386 ]; then
35                                 echo "This is a 32-bit JVM runs on 64-bit system."
36                                 library="$RUNHOME/conf/system/native/linux"
37                 else
38                                 echo "This is a 64-bit JVM runs on 64-bit system."
39                                 library="$RUNHOME/conf/system/native/linux-x86-64"
40                 fi
41         elif [ $PLATFORM = "ia64" ] ;then
42                         library="$RUNHOME/conf/system/native/linux-ia64"
43         else
44                         library="$RUNHOME/conf/system/native/linux"
45         fi
46 fi
47
48 if [ $OSNAME = "SunOS" ] ;then
49         PLATFORM=`uname -p`
50         if [ $PLATFORM = "i386" ] ;then
51                                 library="$RUNHOME/conf/system/native/solaris-x86-32"
52         fi
53
54         if [ $PLATFORM = "sparc" ] ;then
55                 SYS_BIT=`isainfo -b`
56                 echo $SYS_BIT
57                 if [ $SYS_BIT = "64" ] ;then
58                                 JAVA_OPTS="$JAVA_OPTS -d64"
59                                 library="$RUNHOME/conf/system/native/solaris64"
60           else
61                                 library="$RUNHOME/conf/system/native/solaris"
62                 fi
63         fi
64 fi
65
66 if [ $OSNAME = "AIX" ] ;then
67         PLATFORM=`uname -p`
68         if [ $PLATFORM = "powerpc" ] ;then
69                                 library="$RUNHOME/conf/system/native/aix-64"
70         fi
71 fi
72
73 JAVA_OPTS="$JAVA_OPTS -Djava.library.path=$library"
74
75 date_time_string=`date +%Y-%m-%d-%H-%M-%S`
76 if [ $OSNAME != "AIX" ] ;then
77 dump_file_name="dump-dac-$date_time_string.hprof"
78 JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$RUNHOME/logs/$dump_file_name"
79 else
80 JAVA_OPTS="$JAVA_OPTS -Xdump:none"
81 JAVA_OPTS="$JAVA_OPTS -Xdump:system:events=gpf+abort+traceassert,range=1..0,priority=999,request=serial,label=$RUNHOME/logs/core-dac-$date_time_string.dmp"
82 JAVA_OPTS="$JAVA_OPTS -Xdump:heap:events=systhrow,filter=java/lang/OutOfMemoryError,range=1..1,priority=500,request=exclusive+compact+prepwalk,label=$RUNHOME/logs/dump-dac-$date_time_string.phd"
83 JAVA_OPTS="$JAVA_OPTS -Xdump:heap:events=user,priority=500,request=exclusive+compact+prepwalk,label=$RUNHOME/logs/dump-dac-user-$date_time_string.phd"
84 fi
85
86 # set remote debug
87 # port=8306
88 # JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=$port,server=y,suspend=n"
89 echo @JAVA_OPTS@ $JAVA_OPTS
90
91 #class_path="$RUNHOME/:$RUNHOME/boco-driver.jar:$RUNHOME/3rdParty/evel_javalib2-0.0.1.jar"
92 class_path="$RUNHOME/:$RUNHOME/boco-driver.jar"
93 echo @class_path@ $class_path
94 # Start
95 "$JAVA" $JAVA_OPTS -classpath "$class_path" org.onap.vfc.nfvo.emsdriver.EmsDriverApplication server "$RUNHOME/conf/emsdriver.yml"