java 启动 shell脚本

 

run.sh

问题:

http://nqdeng.github.io/7-days-nodejs/

七天学会nodejs

 

http://www.cnblogs.com/zhuxing/articles/1247621.html

 

http://hllvm.group.iteye.com/group/wiki/2870-JVM

 

http://www.cnblogs.com/redcreen/tag/jvm/

 

http://www.maiziedu.com/course/python/342-3449/

 

https://github.com/huangz1990/redis-3.0-annotated

 

http://blog.csdn.net/linuu/article/category/6212307/2   一起学Netty

 

 

http://m.blog.csdn.net/blog/index?username=linuu&cat=1

 

http://mango.jfaster.org/contents.html

 

 

http://www.99ss.org/index.php

 

more ./run.sh 

#!/bin/sh

LOGDIR=/opt/logs/notify/

MAIN_CLASS="com.chanjet.gongzuoquan.notify.App"

 

SERVICE_HOME=/opt/webapps/gongzuoquan-notify-server/

LIB_DIR=${SERVICE_HOME}/lib

CLASSPATH=$CLASSPATH:${SERVICE_HOME}/classes/

files=`ls -1 ${LIB_DIR}`

for file in ${files} ;do

    CLASSPATH=$CLASSPATH:${LIB_DIR}/${file}

done

    

function start(){

        c="`ps -ef | grep -c ${MAIN_CLASS}`"

        if [ $c -le 1 ]; then

                echo "starting..."

                java -server -Xms1024m -Xmx1024m   -Xss512k -XX:-OmitStackTraceInFastThrow  -XX:NewSize=256m -XX:+UseC

oncMarkSweepGC -XX:CMSInitiatingOccupancyFraction=78 -XX:PermSize=256m -XX:MaxPermSize=256m   ${MAIN_CLASS} >$LOGDIR/e

rror.log  2>&1 >$LOGDIR/error.log &

                echo $! > $LOGDIR/pid.log

                echo "started pid:$!"

        else

                echo "already started pid:`cat $LOGDIR/pid.log`"

                exit 0

        fi

}

function stop(){

        c="`ps -ef | grep -c ${MAIN_CLASS}`"

        echo "$c"

        if [ $c -le 1 ]; then

                echo "not running"

                exit 0

        else

                pid="`cat $LOGDIR/pid.log`"

                echo "stoping pid:$pid ..."

                kill $pid

                echo "" > $LOGDIR/pid.log

        fi

}

function restart(){

        stop;

        sleep 30;

        start;

}

 

case    "$1"    in

 

start)

        start

;;

stop)

        stop

;;

restart)

        restart

;;

*)

        echo "require:start|stop|restart"

esac

 

exit 0

 

 

posted @ 2017-01-04 16:29  jhhu  阅读(898)  评论(0编辑  收藏  举报