wiki-files/centos/spring-boot-startup.md

638 B

title description published date tags editor dateCreated
Springboot启动脚本 Springboot启动脚本 true 2021-08-03T09:26:01.422Z springboot, cento markdown 2021-08-03T09:19:13.633Z

启动脚本

编写脚本

$ vim start.sh
#!/bin/sh

# 删除pid输出文件
rm -f tpid
# 启动命令
nohup java -jar -Dspring.profiles.active=prod ./XXX.jar >/dev/null 2>&1 &

# pid输出到文件中
echo $! > tpid

# 描述启动成功
echo Start Success!

启动服务

  1. 直接启动
$ sh ./start.sh
  1. 修改为可执行文件再启动
$ chmod u+x ./start.sh
$ ./start.sh