最新消息:请随时分享你的乐趣!

Linux&Windows java 启动脚本

技术博客 磊子 436浏览 0评论
目录
[隐藏]

记录备用

java 进程 linux shell 启动脚本

脚本一:


#!/bin/sh

FWDIR="$(cd "`dirname $(readlink -nf "$0")`"/.; pwd -P)"

dateformat=`date "+%Y_%m_%d_%H_%M_%S"`

logfile=$FWDIR/logs/metrics.log.${dateformat}

echo "ES Metrics Collector start......... log in ${logfile}"


nohup java -cp ${FWDIR}/lib/commons-io-2.5.jar:${FWDIR}/lib/commons-lang3-3.4.jar:${FWDIR}/lib/fastjson-1.2.5.jar:${FWDIR}/lib/log4j-1.2.17.jar:${FWDIR}/metricssink-1.0.jar     com.ghw.dtm.metrics.common.ESSink < /dev/null >> ${logfile} 2>&1 &

脚本二:

#!/bin/sh
FWDIR="$(cd "`dirname $(readlink -nf "$0")`"/.; pwd -P)"

echo "ES Metrics Collector start......... log in ${logfile}"

CLASSPATH=

for l in `ls lib/*.jar`
do
  CLASSPATH=${CLASSPATH}:$FWDIR/${l}
done

CLASSPATH=${CLASSPATH}:${FWDIR}/data_verify-1.0.jar

echo $CLASSPATH

java -cp $CLASSPATH com.ghw.data.es.TgxgTest $*

windows java 启动脚本

set baseDir=%cd%\lib
setlocal EnableDelayedExpansion    

for /R %baseDir% %%i in (*.jar) do (
    SET CLASSPATH=!CLASSPATH!;%%i
)

java -cp %CLASSPATH%;data_verify-1.0.jar  com.ghw.data.es.TgxgTest %1 %2 %3 %4 %5

@pause  




转载请注明:印迹. » Linux&Windows java 启动脚本

发表我的评论
取消评论

表情