robert trudel
robert trudel

Reputation: 5749

Start a spring boot application via a systemd service

I try to run a spring boot application like a service under almalinux

Content of /etc/systemd/system/tf.service

[Unit]
Description=tf application
After=syslog.target

[Service]
User=almalinux
ExecStart=/home/almalinux/app/tf.jar
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

tf.service: Main process exited, code=exited, status=203/EXEC Jun 04 18:52:15 vps-4210f039.vps.ovh.ca systemd[1]: tf.service: Failed with result 'exit-code'.

Info on the file

50052 -rwxr--r--. 1 almalinux almalinux 51249838 Jun  4 17:55 tf.jar

Info on the service

4 -rwxr-xr-x. 1 root root 204 Jun  4 19:05 /etc/systemd/system/tf.service


sudo systemctl start testamentfacile

Jun 04 19:11:30 vps-4210f039.vps.ovh.ca systemd[1]: Started tf application.
Jun 04 19:11:30 vps-4210f039.vps.ovh.ca systemd[1]: tf.service: Main process exited, code=exited, status=203/EXEC
Jun 04 19:11:30 vps-4210f039.vps.ovh.ca systemd[1]: tf.service: Failed with result 'exit-code'.

So application don't start correctly

If I start application manually with java -jar, I don't have any issue

./tf.jar work fine

Upvotes: 1

Views: 3703

Answers (1)

Dialvive
Dialvive

Reputation: 386

I had the same issue, which was solved calling java by its path, you should probably add a java call before the jar:

ExecStart=/usr/bin/java -jar /home/almalinux/app/tf.jar

Upvotes: 4

Related Questions