- Create service named employee using vi command
sudo vim /etc/systemd/system/employee.service
- Copy paste the following content into the file and make sure to change the ExecStart command arguments
[Unit] Description=Employee Spring Boot application service [Service] User=ubuntu ExecStart=/usr/bin/java -Dspring.profiles.active=prod -Dusername="admin" -Dpassword="Password129388" -jar /home/ubuntu/Employee/target/employee-0.0.1-SNAPSHOT.jar ExitStatus=143 TimeoutStopSec=10 Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target
- Enable the service
sudo systemctl enable employee
- Start the service
sudo systemctl start employee
- Reload system daemon
sudo systemctl daemon-reload
- Check the service status
sudo systemctl status employee
- Check service logs using the following command
sudo journalctl -u employee.service --no-pager
Forked from pavankjadda/How to create Spring Boot app as Ubuntu service.md
Created
October 25, 2023 07:49
-
-
Save jmy2022/5ecd3f1dbf3cedee115b1c816dcd0383 to your computer and use it in GitHub Desktop.
How to create Spring Boot app as Ubuntu service?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment