springboot 启动停止脚本

https://www.cnblogs.com/lovychen/p/6211209.html   参考

centos 转码解决方案:
yum install dos2unix

dos2unix **.sh

#!/bin/bash
pid=$(ps -ef | grep spring-boot-app.jar | grep -v grep | awk '{print $2}')
if [[ -z "${pid}" ]]
then
echo application is already stop
else
echo kill ${pid}
kill -9 ${pid}
fi

 

#!/usr/bin/env bash
pid=$(ps -ef | grep spring-boot-app.jar | grep -v grep | awk '{print $2}')
if [[ -z "${pid}" ]]
then
echo application is starting
nohup java -jar spring-boot-app.jar &
else
echo echo application alread start
echo process is ${pid}
fi

猜你喜欢

转载自www.cnblogs.com/javajetty/p/11626054.html