520. Register app as service with systemctl - dkkahm/study-springfamework5 GitHub Wiki
Service definition (/etc/systemd/system/springboot.service)
[Unit]
Description=Spring Boot Service
After=syslog.target
[Service]
User=ec2-user
# set dir to location of application.properties and springboot.jar
WorkingDirectory=/home/ec2-user
ExecStart=/bin/java -jar spring-core-devops-0.0.1.jar
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
register and start servcie
- systemctl daemon-reload
- systemctl enable springboot.service
- systemctl start springboot
view console output