`

java平台启动脚本

    博客分类:
  • java
 
阅读更多

 window平台java启动脚本

 

 

 

@echo off
set JAVA_HOME=
set JAVA_OPTS=-Xms64m -Xmx512m
set CLASSPATH=.\classes

for %%c in (".\lib\*.jar") do call :LIBAPPEND %%c

if exist "%JAVA_HOME%\bin\java.exe" goto okHome

echo The JAVA_HOME environment variable is not defined correctly
echo JAVA_HOME未设置或设置错误
@pause
goto end

:okhome
echo Using JAVA_HOME	%JAVA_HOME%
"%JAVA_HOME%\bin\java" %JAVA_OPTS% -cp %CLASSPATH% com.xxx.xxx.xxx.util.EstimationDownload

:end

:LIBAPPEND
set CLASSPATH=%CLASSPATH%;%1

  

 

 linux平台

#!/bin/sh
JAVA_HOME=
JAVA_OPTS="-Xms64m -Xmx512m"
CLASSPATH=${CLASSPATH}:"./classes":`echo ./lib/*.jar | sed "s/ /:/g"`

if [ -z "${JAVA_HOME}" ] ; then
    echo "请设置JAVA_HOME"
    echo "Please set JAVA_HOME"
    exit 1
fi
if [ ! -x "${JAVA_HOME}/bin/java" ] ; then
    echo "JAVA_HOME设置错误"
    echo "Can not find Java VM"
    exit 1
fi

echo "Using JAVA_HOME   ${JAVA_HOME}"
echo "Using CLASSPATH   ${CLASSPATH}"

"${JAVA_HOME}/bin/java" ${JAVA_OPTS} -cp ${CLASSPATH} com.xxx.xxx.xxx.StockSend

 

startup.sh

java -server -da -Xss128k -cp ./config:./lib/*:a.jar com.test.Test &
echo $! > service.pid

 

 

shutdown.sh

#!/bin/sh
echo 'Stoping the I/O Service...'
pid=`cat "service.pid"`
kill $pid
echo 'Stoped.'

 

 nginx 启动某个tomcat:

 

sed -i 's/\(.*8092.*\) down/\1/' /etc/nginx/upstream.d/martin.conf
cat /etc/nginx/upstream.d/martin.conf
nginx -t
nginx -s reload

 

 nginx 关闭8092端口tomcat:

ed -i 's/\(.*8092.*weight=1\)[ ;]*$/\1 down;/' /etc/nginx/upstream.d/martin.conf
cat /etc/nginx/upstream.d/martin.conf
nginx -t
nginx -s reload

 

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics