发布SpringBoot程序的Shell脚本

发布SpringBoot程序的Shell脚本

#!/usr/bin/bash
PID=$(ps -ef | grep ${1} | grep -v $0 |grep -v grep |awk "{print $2}")
if [ -z "${PID}" ]; then
  echo "程序未启动,无需停止进程"
else
  for ID in ${PID}
  do
    echo ${ID}
    kill -9 ${ID}
  done
fi

start.sh

#!/usr/bin/bash
cd ${1}
source /etc/profile
nohup java -jar ${2} --spring.profiles.active=${3} >/dev/null 2>&1 &