修改打包maven脚本

添加启动分析脚本
This commit is contained in:
zhang.xin 2016-03-09 18:16:03 +08:00
parent 1b243501e2
commit 9560e35ea2
2 changed files with 89 additions and 31 deletions

View File

@ -0,0 +1,75 @@
#!/bin/bash
# check environment virables
SW_ANALYSIS_HOME=/tmp/skywalking-analysis
# check Java home
if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
if $darwin; then
# Bugzilla 54390
if [ -x '/usr/libexec/java_home' ] ; then
export JAVA_HOME=`/usr/libexec/java_home`
# Bugzilla 37284 (reviewed).
elif [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home"
fi
else
JAVA_PATH=`which java 2>/dev/null`
if [ "x$JAVA_PATH" != "x" ]; then
JAVA_PATH=`dirname $JAVA_PATH 2>/dev/null`
JRE_HOME=`dirname $JAVA_PATH 2>/dev/null`
fi
if [ "x$JRE_HOME" = "x" ]; then
# XXX: Should we try other locations?
if [ -x /usr/bin/java ]; then
JRE_HOME=/usr
fi
fi
fi
if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
echo "Neither the JAVA_HOME nor the JRE_HOME environment variable is defined"
echo "At least one of these environment variable is needed to run this program"
exit 1
fi
fi
if [ -z "$JAVA_HOME" -a "$1" = "debug" ]; then
echo "JAVA_HOME should point to a JDK in order to run in debug mode."
exit 1
fi
if [ -z "$JRE_HOME" ]; then
JRE_HOME="$JAVA_HOME"
fi
#check hbase home
HBASE_HOME=${HOME}/hbase-1.1.2
#check hadoop home
HADOOP_HOME=${HOME}/hadoop-2.6.0
## check provious execute time
PID_DIR="${SW_ANALYSIS_HOME}/tmp"
if [ ! -d "$PID_DIR" ]; then
mkdir -p $PID_DIR
fi
PID_FILES="${PID_DIR}/analysis.pid"
if [ ! -f "$FILE_PROVIOUS_EXECUTE_TIME" ]; then
touch "$PID_FILES"
fi
START_TIME=`cat ${PID_FILES}`
if [ "$START_TIME" = "" ]; then
START_TIME=`date --date='3 month ago' "+%Y-%m-%d/%H:%M:%S"`
fi
#echo $START_TIME
##Get the current datetime
END_TIME=`date "+%Y-%m-%d/%H:%M:%S"`
#echo $END_TIME
## execute command
HADOOP_CLASSPATH=`${HBASE_HOME}/bin/hbase classpath` ${HADOOP_HOME}/bin/hadoop jar skywalking-analysis-1.0-SNAPSHOT.jar ${START_TIME} ${END_TIME}
echo $END_TIME > ${PID_FILES}

View File

@ -15,12 +15,6 @@
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
@ -71,6 +65,7 @@
<target>1.7</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
<version>3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -92,43 +87,31 @@
</manifest>
</archive>
</configuration>
<version>2.4</version>
<executions>
<execution>
<phase>package</phase>
</execution>
</executions>
</plugin>
<!--<plugin>-->
<!--<artifactId>maven-dependency-plugin</artifactId>-->
<!--<executions>-->
<!--<execution>-->
<!--<id>copy-dependencies</id>-->
<!--<phase>prepare-package</phase>-->
<!--<goals>-->
<!--<goal>copy-dependencies</goal>-->
<!--</goals>-->
<!--</execution>-->
<!--</executions>-->
<!--<configuration>-->
<!--<excludeGroupIds>org.apache.hbase,org.apache.hadoop</excludeGroupIds>-->
<!--<outputDirectory>${project.build.directory}/classes/libs</outputDirectory>-->
<!--</configuration>-->
<!--</plugin>-->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>make-my-jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.ai.cloud.skywalking.analysis.AnalysisServerDriver</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>