Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. ## How to create Spring Boot app as Ubuntu service?
  2. 1. Create service named **employee** using vi command
  3. ```
  4. sudo vim /etc/systemd/system/employee.service
  5. ```
  6. 2. Copy paste the following content into the file and make sure to change the **ExecStart** command arguments
  7. ```
  8. [Unit]
  9. Description=Employee Spring Boot application service
  10.  
  11. [Service]
  12. User=ubuntu
  13. ExecStart=/usr/bin/java -Dspring.profiles.active=prod -Dusername="admin" -Dpassword="Password129388" -jar /home/ubuntu/Employee/target/employee-0.0.1-SNAPSHOT.jar
  14. ExitStatus=143
  15.  
  16. TimeoutStopSec=10
  17. Restart=on-failure
  18. RestartSec=5
  19.  
  20. [Install]
  21. WantedBy=multi-user.target
  22. ```
  23. 3. Enable the service
  24. ```
  25. sudo systemctl enable employee
  26. ```
  27. 4. Start the service
  28. ```
  29. sudo systemctl start employee
  30. ```
  31. 5. Reload system daemon
  32. ```
  33. sudo systemctl daemon-reload
  34. ```
  35. 6. Check the service status
  36. ```
  37. sudo systemctl status employee
  38. ```
  39. 7. Check service logs using the following command
  40. ```
  41. sudo journalctl -u employee.service --no-pager
  42. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement