Create a systemd service sudo nano /etc/systemd/system/webapp.service [Unit] Description=Webapp Service [Service] User=username #the workspace WorkingDirectory=/home/username/webapp #command or path to executable. ExecStart=/path/to/java -jar -Dspring.profiles.active=prod webapp.jar SuccessExitStatus=143 TimeoutStopSec=10 Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target Enable and start the service sudo systemctl daemon-reload sudo systemctl enable webapp.service sudo systemctl start webapp sudo systemctl status webapp Show service logs sudo journalctl -f -u webapp