在服务器/etc/systemd/system目录下面新建一个启动文件 ,名称以service结尾,例如:vi /etc/systemd/system/kuochan.com.service
在文件中保存下面的内容:
[Unit]
Description=kuochan.com service
After=syslog.target
[Service]
Type=simple
ExecStart=/data/program/java1.8/bin/java -jar /www/wwwroot/kuochan.com/my-springboot-0.0.1-SNAPSHOT.jar –spring.profiles.active=prod
[Install]
WantedBy=multi-user.target
保存好设置开机启动:systemctl enable kuochan.com.service
启动: systemctl start kuochan.com.service
停止:systemctl stop kuochan.com.service
重启:systemctl restart kuochan.com.service
转载请注明:扩产网 » CentOS服务器部署SpringBoot项目并设为开机启动