基于Linux的Systemd部署
jar: springboot-test.jar
jar所在目录 /opt
在/etc/systemd/system/目录下新建文件springboot-test.service
[Unit]
Description=test
After=syslog.target
[Service]
ExecStart= /usr/locl/java -jar /opt/springboot-test.jar
[Install]
WantedBy=multi-user.target
java命令要带目录
然后
systemctl daemon-reload
启动:
systemctl start springboot-test
停止:
扫描二维码关注公众号,回复:
13220011 查看本文章
systemctl stop springboot-test
服务状态:
systemctl status springboot-test
开机启动:
systemctl enable springboot-test