Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## How to create Spring Boot app as Ubuntu service?
- 1. Create service named **employee** using vi command
- ```
- sudo vim /etc/systemd/system/employee.service
- ```
- 2. 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
- ```
- 3. Enable the service
- ```
- sudo systemctl enable employee
- ```
- 4. Start the service
- ```
- sudo systemctl start employee
- ```
- 5. Reload system daemon
- ```
- sudo systemctl daemon-reload
- ```
- 6. Check the service status
- ```
- sudo systemctl status employee
- ```
- 7. Check service logs using the following command
- ```
- sudo journalctl -u employee.service --no-pager
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement