linux 启动springboot项目脚本 start.sh


  pid=`ps -ef|grep ecs-2022-open-1.0-SNAPSHOT.jar|grep -v grep|awk '{print $2}' `
    #如果不存在返回1,存在返回0     
      if [ -z "${pid}" ]; then
          nohup  java -jar -Dserver.port=8080  ecs-2022-open-1.0-SNAPSHOT.jar  --spring.profiles.active=$ACTIVE   > log.file 2>&1 &
          echo "is start"
      else
          echo "ecs-2022-open-1.0-SNAPSHOT.jar is already running. pid=${pid} ."
          kill -9 $pid
          echo "is kill"
          nohup  java -jar -Dserver.port=8080  ecs-2022-open-1.0-SNAPSHOT.jar  --spring.profiles.active=$ACTIVE   > log.file 2>&1 &
          echo "is start"
  fi

你可能感兴趣的:(linux,spring,boot,java)