當(dāng)前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
使用Systemd包装SpringBoot应用
生活随笔
收集整理的這篇文章主要介紹了
使用Systemd包装SpringBoot应用
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
為應(yīng)用建立一個service文件
my-webapp.service
[Unit] Description=SpringBoot REST Service[Service] User=ubuntu WorkingDirectory=/usr/local/src/workspace/my-webapp #要執(zhí)行程序的路徑 #調(diào)用jar文件的shell執(zhí)行文件 fileExecStart=/usr/local/src/workspace/my-webapp/start.sh SuccessExitStatus=143 TimeoutStopSec=10 Restart=on-failure RestartSec=5[Install] WantedBy=multi-user.target保存在/etc/systemd/system目錄下
創(chuàng)建腳本文件start.sh
#!/bin/sh?
sudo /usr/bin/java -jar my-webapp-1.0-SNAPSHOT.jar?
并授予可執(zhí)行權(quán)限
sudo chmod u+x start.sh
啟動服務(wù)
sudo systemctl daemon-reload?
sudo systemctl enable my-webapp.service?
sudo systemctl start my-webapp?
sudo systemctl status my-webapp
停止服務(wù)
sudo systemctl stop my-webapp
總結(jié)
以上是生活随笔為你收集整理的使用Systemd包装SpringBoot应用的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: USB相关知识
- 下一篇: Springboot Gitlab Je