Skip to content

Ubuntu下配置spring boot项目使用systemd服务自动启动

gexiangdong edited this page May 31, 2018 · 3 revisions

创建配置文件,内容如下

[Unit]  
Description=tutorial
After=syslog.target  
  
[Service]  
ExecStart=/usr/bin/java -jar -Xms256m -Xmx1G  -Dlog.level.console=warn -Dlog.level.ysb=info /web/webapps/tutorial-1.0.jar --spring.profiles.active=production 
SuccessExitStatus=143  
  
[Install]  
WantedBy=multi-user.target

配置文件放入/lib/systemd/system/tutorial.service

然后执行:

systemctl enable auth2-server.service
systemctl daemon-reload

之后可以使用

service auth2-server start

启动

Clone this wiki locally