SpringBoot启动和停止脚步

1.start.sh

# start.sh 启动项目
#!/bin/sh
file="/123/springcloud/admin.jar"
if [ -f "$file" ];then
  if [ ! -x "$file" ];then
    echo "授权执行权限,文件:$file"
    chmod a+x $file
  fi
  echo "开始执行文件:$file"
  nohup java -jar $file > /123/springcloud/admin-log.txt --spring.profiles.active=common,mybatisplus,prd &
else
  echo "未找到文件:$file"
fi

3.stop.sh

# 将应用停止
#stop.sh
#!/bin/bash
file="kq-admin.jar"
pid=`ps -ef | grep $file | grep -v grep | awk '{print $2}'`
if [ -n "$pid" ];then
   echo "kill $file, pid=$pid"
   kill -9 $pid
else
  echo "未找到执行程序:$file"
fi

backup.sh

#back.sh 用于将上次构建的结果备份,然后将新的构建结果移动到合适的位置
#!/bin/bash
# 先判断文件是否存在,如果存在,则备份
file="/lhdata/springcloud/kq/kq-admin.jar"
if [ -f "$file" ];then
  cp $file $file.`date +%Y%m%d%H%M%S`
else
  echo "未找到文件:$file"
fi

 

posted @ 2018-10-26 17:28  甜菜波波  阅读(578)  评论(0编辑  收藏  举报