欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

启动/关闭Spring boot服务脚本

程序员文章站 2022-08-15 22:06:08
启动Spring boot服务脚本 关闭Spring boot服务脚本 ......

启动spring boot服务脚本

#!/bin/bash
cd /test
java -jar test.jar &> ./test.log & 
echo "成功"

关闭spring boot服务脚本

#!/bin/bash
app_name="test.jar"
echo "stop springboot application"
pid=`ps -ef | grep $app_name | grep -v grep | awk '{print $2}'`
if [ -n "$pid" ]
then
kill -9 $pid
fi