`
thecloud
  • 浏览: 881831 次
文章分类
社区版块
存档分类
最新评论

Startup a JAVA standalone program in UNIX use shell script

 
阅读更多

chkpid=`ps -ef | grep [H]NWFileAnalysis | wc -l`
if [ $chkpid -gt 0 ] ; then
./stopHNWFileAnalysis.sh
fi

if [ -z "$JAVA_HOME" ] ; then
`grep export setenv-java.sh`
fi
BASEDIR=`dirname $0`/..
BASEDIR=`(cd "$BASEDIR"; pwd)`

datetime() { echo "`date +%Y-%m-%d.%H:%M`"; }

# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
Darwin*) darwin=true
if [ -z "$JAVA_VERSION" ] ; then
JAVA_VERSION="CurrentJDK"
else
echo "Using Java version: $JAVA_VERSION"
fi
if [ -z "$JAVA_HOME" ] ; then
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home
fi
;;
esac

if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi

# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi

# If a specific java binary isn't specified search for the standard 'java' binary
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD=`which java`
fi
fi

#if [ ! -x "$JAVACMD" ] ; then
# echo "Error: JAVA_HOME is not defined correctly."
# echo " We cannot execute $JAVACMD"
# exit 1

#fi

if [ -z "$REPO" ]
then
REPO="$BASEDIR"/lib
fi

CLASSPATH=$CLASSPATH_PREFIX:"$BASEDIR"/conf:"$REPO"/jconnect-2.jar:"$REPO"/commons-pool-1.5.4.jar:"$REPO"/commons-dbcp-1.4.jar:"$REPO"/jconn3-6.0.jar:"$REPO"/spring-2.5.6.jar:"$REPO"/commons-dbcp-1.4.jar:"$REPO"/gateway-1.0_A8.jar:"$REPO"/commons-cli-1.2.jar:"$REPO"/aspen-rmiclient-1.1_B1.jar:"$REPO"/spring-1.0_A0.jar:"$REPO"/com.springsource.org.aopalliance-1.0.0.jar:"$REPO"/camel-spring-2.7.2.jar:"$REPO"/spring-context-3.0.5.RELEASE.jar:"$REPO"/spring-expression-3.0.5.RELEASE.jar:"$REPO"/spring-asm-3.0.5.RELEASE.jar:"$REPO"/spring-aop-3.0.5.RELEASE.jar:"$REPO"/aopalliance-1.0.jar:"$REPO"/spring-tx-3.0.5.RELEASE.jar:"$REPO"/camel-jaxb-2.7.2.jar:"$REPO"/jaxb-api-2.1.jar:"$REPO"/camel-jms-2.7.2.jar:"$REPO"/spring-jms-3.0.5.RELEASE.jar:"$REPO"/spring-core-3.0.5.RELEASE.jar:"$REPO"/spring-beans-3.0.5.RELEASE.jar:"$REPO"/camel-quartz-2.7.2.jar:"$REPO"/quartz-1.8.4.jar:"$REPO"/jta-1.1.jar:"$REPO"/commons-collections-3.2.1.jar:"$REPO"/camel-netty-2.7.2.jar:"$REPO"/org.apache.servicemix.bundles.netty-3.2.3.Final_1.jar:"$REPO"/spring-test-3.0.5.RELEASE.jar:"$REPO"/slf4j-log4j12-1.6.1.jar:"$REPO"/slf4j-api-1.6.1.jar:"$REPO"/log4j-1.2.16.jar:"$REPO"/junit-4.8.2.jar:"$REPO"/commons-io-1.4.jar:"$REPO"/commons-codec-1.5.jar:"$REPO"/commons-httpclient-2.0.2.jar:"$REPO"/commons-logging-1.1.1.jar:"$REPO"/commons-lang-2.6.jar:"$REPO"/mirrorlake-1.0_A8.jar:"$REPO"/mirrorlake-rmiclient-2.0_D0.jar:"$REPO"/gfinet_config_all-3.1_G0.jar:"$REPO"/tibjms-5.1.5l.jar:"$REPO"/wlfullclient6-10.3.jar:"$REPO"/dsp4-1.0_A8.jar:"$REPO"/dsp_client-1.2_C0.jar:"$REPO"/dsp_gemfire-1.2_C0.jar:"$REPO"/dsp_common-1.2_C0.jar:"$REPO"/gemfire-6.5.jar:"$REPO"/gfinet_messaging-2.2_D3.jar:"$REPO"/gfinet_config-3.1_G0.jar:"$REPO"/gficore_all-12.4_Y0.jar:"$REPO"/jms-4.4.3l.jar:"$REPO"/camel-core-2.8.6.jar:"$REPO"/commons-management-1.0.jar:"$REPO"/dspModelClient-1.21_V0.jar:"$REPO"/camel-ahc-2.8.6.jar:"$REPO"/async-http-client-1.6.5.jar:"$REPO"/netty-3.2.5.Final.jar:"$REPO"/ojdbc6-11g.jar:"$REPO"/commons-httpclient-3.1_1.jar:"$REPO"/gxs-1.0_A8.jar:"$REPO"/jibx-run-1.2.1.jar:"$REPO"/wstx-asl-3.2.1.jar:"$REPO"/stax-api-1.0.1.jar:"$REPO"/jibx-extras-1.2.1.jar:"$REPO"/gxServiceClient-1.0_A4_2.jar:"$REPO"/jaxws-rt-2.2.7.jar:"$REPO"/jaxws-api-2.2.8.jar:"$REPO"/saaj-api-1.3.4.jar:"$REPO"/javax.annotation-3.1.1.jar:"$REPO"/jsr181-api-1.0-MR1.jar:"$REPO"/jaxb-impl-2.2.6.jar:"$REPO"/saaj-impl-1.3.19.jar:"$REPO"/streambuffer-1.5.jar:"$REPO"/stax-api-1.0-2.jar:"$REPO"/activation-1.1.jar:"$REPO"/woodstox-core-asl-4.1.2.jar:"$REPO"/stax2-api-3.1.1.jar:"$REPO"/mimepull-1.8.jar:"$REPO"/policy-2.3.1.jar:"$REPO"/txw2-20110809.jar:"$REPO"/relaxngDatatype-20020414.jar:"$REPO"/istack-commons-runtime-2.4.jar:"$REPO"/stax-ex-1.7.jar:"$REPO"/gmbal-api-only-3.1.0-b001.jar:"$REPO"/management-api-3.0.0-b012.jar:"$REPO"/ha-api-3.1.8.jar:"$REPO"/restclient-2.3.jar:"$REPO"/httpclient-4.1.1.jar:"$REPO"/httpcore-4.1.jar:"$REPO"/jetty-6.0.2.jar:"$REPO"/camel-jetty-2.7.2.jar:"$REPO"/camel-http-2.7.2.jar:"$REPO"/geronimo-servlet_2.4_spec-1.1.1.jar:"$REPO"/jetty-server-7.2.2.v20101205.jar:"$REPO"/servlet-api-2.5.jar:"$REPO"/jetty-continuation-7.2.2.v20101205.jar:"$REPO"/jetty-http-7.2.2.v20101205.jar:"$REPO"/jetty-io-7.2.2.v20101205.jar:"$REPO"/jetty-security-7.2.2.v20101205.jar:"$REPO"/jetty-servlet-7.2.2.v20101205.jar:"$REPO"/jetty-servlets-7.2.2.v20101205.jar:"$REPO"/jetty-util-7.2.2.v20101205.jar:"$REPO"/jetty-client-7.2.2.v20101205.jar:"$REPO"/jetty-jmx-7.2.2.v20101205.jar:"$REPO"/jetty-webapp-7.2.2.v20101205.jar:"$REPO"/jetty-xml-7.2.2.v20101205.jar:"$REPO"/maven-rpm-plugin-1.0.jar:"$REPO"/HNWFileAnalysis-1.0_A1.jar
EXTRA_JVM_ARGUMENTS="-XX:+ScavengeBeforeFullGC -Xms256m -Xmx2048m -Dlog.prefix=mlsub -Dml.env=UAT -XX:PermSize=64m -XX:MaxPermSize=256m -Dcom.sun.management.jmxremote.port=9998 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"

export JAVA_HOME=/export/opt/jrockit/6.0_14R27.6.5l64
JAVACMD=$JAVA_HOME/bin/java
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$HOME" ] && HOME=`cygpath --path --windows "$HOME"`
[ -n "$BASEDIR" ] && BASEDIR=`cygpath --path --windows "$BASEDIR"`
[ -n "$REPO" ] && REPO=`cygpath --path --windows "$REPO"`
fi

export BASEDIR=/opt/HNW/HNWFileAnalysis/1.0_A1
export JAVA_OPTS="-server"
nohup "$JAVACMD" $JAVA_OPTS \
$EXTRA_JVM_ARGUMENTS \
-classpath "$CLASSPATH" \
-Dapp.name="HNWFileAnalysis" \
-Dapp.pid="$$" \
-Dapp.repo="$REPO" \
-Dbasedir="$BASEDIR" \
gravity.framework.core.ApplicationContextGateway conf/hnw_file_feed.xml \
>> /opt/HNW/HNWFileAnalysis/logs/hnw.log.`datetime`.$$ &
JAVAPID=`echo $!`
echo Process ID: $JAVAPID.

export LOGDIR=/opt/HNW/HNWFileAnalysis/logs
rm -f $LOGDIR/hnw.log
ln -s $LOGDIR/hnw.log.`datetime`.$$ $LOGDIR/hnw.log

分享到:
评论

相关推荐

    Pro CDI 2 in Java EE 8.pdf

    They show you how to use CDI in a Java SE environment with the new CDI initialization and configuration API, and how to dynamically modify the configuration of beans at application startup by using ...

    nacos启动文件startup.cmd

    startup.cmd

    mybatis-generator自动生成字段注释的maven项目,执行StartUp.java即可

    mybatis-generator自动生成字段注释的maven项目,执行StartUp.java即可

    modelsim 命令解释

    modelsim的命令解释,pdf格式,modelsim的帮助文件

    BURNINTEST--硬件检测工具

    - Updated license management, in an attempt to remove a rare crash on startup. Release 5.3 build 1012.0002 WIN32 release 31 October 2007 - New build of Rebooter (64-bit Windows correction). - ...

    startup.sh

    startup.sh

    The.Startup.Equation.A.Visual.Guidebook.to.Building.Your.Startup

    Filled with insightful case studies, The Startup Equation is a vibrant, practical guide to creating a winning business model for any startup. By following the accessible visual roadmap within, you'll ...

    Unix solaris 11.1 iso最新版本

    A new Oracle Solaris DTrace plug-in for Oracle Java Mission Control to enable customers to profile Java applications on Oracle Solaris production systems. New cloud management features add to Oracle ...

    SHELL脚本监控JAVA进程的代码

    脚本内容:java_check.sh #! /bin/bash # if [ -z `pidof java` ]; then echo -e `date +%Y-%m-%d` `date +%R`. “33[31m33[1m(JAVA)Process does not exist! 33[0m” >> /data/logs/java_check.log /usr/local/...

    The Java Module System.epub

    Java 11 includes a built-in modularity framework, and The Java Module System is your guide to discovering it. In this new book, you'll learn how the module system improves reliability and ...

    Wince 6 startup processes

    Wince 6 startup processes, PROC: Name hProcess: CurAKY :dwVMBase:CurZone P00: NK.EXE 00400002 00000000 80070000 0000000b P01: shell.exe 00eb0002 00000000 00010000 00000000 P02: udevice.exe 01a...

    Mastering Java for Data Science

    Java is the most popular programming language, according to the TIOBE index, and it is a very typical choice for running production systems in many companies, both in the startup world and among large...

    U盘版EFI SHELL

    将压缩包解压到U盘根目录,在BIOS中使用UEFI方式从U盘启动,即可进入EFI SHELL。IA32和X64都支持,调试必备。

    Java Performance

    “The definitive master class in performance tuning Java applications…if you love all the gory details, this is the book for you.” –James Gosling, creator of the Java Programming Language ...

    AURIX_2ndGeneration_Startup_and_Initialisation.pdf

    Startup

    nacos的 standalone模式启动bat

    startup_nacos_by_standalone.bat,windows下nacos的standalone模式启动

    信息: Deploying web application directory lx01

    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964) at org.apache.catalina.startup....

    VB编程资源大全(英文源码 其它)

    "This technique allows a program to save hierarchical information like the data in a TreeView in a way that is easy to understand."<END><br>11 , OLE.zip Demonstrates the use of OLE.<END><br>12 , ...

    STM32f10x_startup

    STM32f10x系列的startup文件(.s文件),从例程代码里拿出来的,方便以后自己找。 ps.貌似必须收费至少1分啊。。。

    startup.sh linux 启动jar包命令

    startup.sh linux 启动jar包命令startup.sh linux 启动jar包命令startup.sh linux 启动jar包命令startup.sh linux 启动jar包命令startup.sh linux 启动jar包命令

Global site tag (gtag.js) - Google Analytics