java 配置linux 启动节点

source ../jar.cfg

nohup java -Dprogram.name=route-customBatch.sh \

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9919 \

-server -Xmx16G -Xms16G -XX:PermSize=50m -XX:MaxPermSize=50m -Xss256K \

-XX:+DisableExplicitGC -XX:SurvivorRatio=1 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC \

-XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=0 \

-XX:+CMSClassUnloadingEnabled -XX:LargePageSizeInBytes=128M -XX:+UseFastAccessorMethods \

-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=40 -XX:SoftRefLRUPolicyMSPerMB=0 \

-Dcom.sun.management.jmxremote.port=18501 \

-Dcom.sun.management.jmxremote.ssl=false \

-Dcom.sun.management.jmxremote.authenticate=false \

-cp .:../$jarname\

:../lib/* com.sf.module.routeconfig.util.CustomBatchApp 2016-04-20 &

stop文件

ps -ef|grep route-customBatch|grep -v grep|cut -c 9-15|xargs /bin/kill -9 

start.sh

#!/bin/sh

#Kill already existing process

psid=`/usr/local/java/jdk1.7.0_79/bin/jps -l | grep com.sunline.core.mktinfo.SunlineMKServer  | awk '{print $1}'`

    if [ $psid ]; then

        su - root -c "kill -9 $psid"

    fi

programdir="."

num=$#

temp=$CLASSPATH

#setting libs path

libs=./lib/*

append(){

  temp=$temp":"$1

}

for file in $libs;    do

  append $file

done

append ":sunline-MK-Server.jar"

export CLASSPATH=$temp:.:$programdir

export LANG=zh_CN

nohup /usr/local/java/jdk1.7.0_79/bin/java -server -Xms4048m -Xmx4048m -XX:-PrintGC -XX:-PrintGCDetails -XX:-PrintGCTimeStamps -Xloggc:logs/gc.log -Djava.rmi.server.hostname=120.77.38.110 -Dcom.sun.management.jmxremote.port=18999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false  -classpath $CLASSPATH  com.sunline.core.mktinfo.SunlineMKServer & 

psid=0

psid=`/usr/local/java/jdk1.7.0_79/bin/jps -l | grep com.sunline.core.mktinfo.SunlineMKServer  | awk '{print $1}'`

   if [[ $psid -ne 0 ]]; then

      echo "(pid=$psid) [Start OK]"

   else

      echo "[Start Failed]"

fi

stop.sh

#!/bin/sh

psid=0

psid=`/usr/local/java/jdk1.7.0_79/bin/jps -l | grep com.sunline.core.mktinfo.SunlineMKServer | awk '{print $1}'`

stop() {

   if [ $psid -ne 0 ]; then

      echo -n "Stopping com.sunline.core.mktinfo.SunlineMKServer ...(pid=$psid) "

      su - root -c "kill -9 $psid"

      if [ $? -eq 0 ]; then

         echo "[OK]"

      else

         echo "[Failed]"

      fi

   else

      echo "================================"

      echo "warn: com.sunline.core.mktinfo.SunlineMKServer is not running"

      echo "================================"

   fi

}

stop

exit 0

相关推荐