Spring 启动脚本
if [ $# != 3 ];then echo 'option-1: start,stop or restart.' echo 'option-2: 请传入jar路径' echo 'option-3: log名称' exit; fi option=$1 jarname=$2 logName=$3 if [ $option = "start" ];then nohup java -Xms512M -Xmx1024M -jar $jarname > /data/service/yun/logs/$logName.log 2>&1 & elif [ $option = "stop" ];then pids=`ps -ef | grep $jarname | grep -v "grep" | awk '{print $2}'` if [ "$pids" = "" ]; then echo "no kill !" else echo "kill with $pids" /bin/kill -9 ${pids} fi elif [ $option = "restart" ];then pids=`ps -ef | grep $jarname | grep -v "grep" | awk '{print $2}'` if [ "$pids" = "" ]; then echo "no kill !" else echo "kill with $pids" /bin/kill -9 ${pids} fi sleep 3 nohup java -Xms512M -Xmx1024M -jar $jarname > /data/service/yun/logs/$logName.log 2>&1 & else exit 0 fi