springboot 项目启动脚本

springboot项目启动可通过下面的shell脚本启动。

startup.sh  

 1 app=order-service-rest.jar
 2 appout=logs/${app/.jar/.out}
 3 appoutHisDir=logs/`date "+%Y%m%d"`
 4 if test ! -d 'logs' ; then
 5   mkdir logs 
 6 fi 
 7 if test ! -f $appout ; then
 8   touch $appout
 9 fi
10 if test ! -d $appoutHisDir ;then
11     echo 'mdkir ' $appoutHisDir
12     mkdir -p $appoutHisDir &&
13     gzfiles=$(find logs -maxdepth 1 -name *.gz)
14     if test ${#gzfiles} -ne 0 ;then
15         mv logs/*.gz  $appoutHisDir/
16     fi
17     cp logs/*.out $appoutHisDir/ &&
18     for hisout in $(ls logs/*.out)
19     do    
20         echo '' > $hisout
21     done
22 fi
23 appPid=`jps -l|grep $app|awk '{print $1}'`
24 if test ${#appPid} -ne 0 ;then
25     echo 'stop server ' $appPid '...'
26     kill -9 $appPid
27 fi
28 nohup java -jar $app >> $appout &
29 tail -0f $appout

 启动命令

./startup.sh  order-service-rest.jar

 

posted @ 2019-10-16 11:08  java白丁  阅读(3167)  评论(0编辑  收藏  举报