CentOS7下添加 springboot
包为 Systemd
服务
配置
添加配置文件, jar包是 web1.jar
$ vim /etc/systemd/system/m.web1.service
[Unit]
Description=m.web1
After=syslog.target
[Service]
User=root
ExecStart=/opt/jdk/bin/java -jar /opt/project-1/web1.jar
[Install]
WantedBy=multi-user.target
常用命令
- 首次重载
$ systemctl daemon-reload
- 查看状态
$ systemctl status m.web1
- 启动
$ systemctl start m.web1
- 关闭
$ systemctl stop m.web1
- 开机自启
$ systemctl enable m.web1
网友评论