1.在/etc/systemd/system/目录下新建文件springboot-test.service
[Unit]
Description=springboot-test
After=syslog.target
[Service]
ExecStart= /usr/bin/java -jar /home/test-0.0.1-SNAPSHOT.jar
[Install]
WantedBy=multi-user.target
2.systemctl start springboot-test
或systemctl start springboot-test.service
//设置开机自启
systemctl status springboot-test
或systemctl status springboot-test.service
//设置开机自启
systemctl enable springboot-test
或systemctl enable springboot-test.service
//查看日志
journalctl -u springboot-test
或 journalctl -u tespringboot-test.service
网友评论