dsharew
dsharew

Reputation: 10665

Unable to start systemd service of springboot application

I followed the spring documentation for creating systemd service to create a startup script for my springboot app.

FYI: I have see this resolved issue on github which states the issue is a permission issue but does not work for me the jar has 755 permission.

Here is my service description:

[Unit]
Description=gs-spring-boot-0.1.0
After=syslog.target

[Service]
ExecStart=/home/user/deploy/gs-spring-boot-0.1.0.jar
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

When I try to enable the service like this:

sudo systemctl enable  gs-spring-boot-0.1.0.service

am getting this error:

update-rc.d: error: gs-spring-boot-0.1.0 Default-Start contains no runlevels, aborting.

When I check the status this is the output: enter image description here

enter image description here

Note: I am using ubuntu and the jar file has permission: 755

Any help is appreciated.

Upvotes: 1

Views: 1508

Answers (1)

dsharew
dsharew

Reputation: 10665

Sorry adding this to build.gradle was the solution:

bootRepackage { executable = true }

It makes the jar to be executable. i.e after adding this code you should be able to run the app with this command:

./app-name.jar

Upvotes: 2

Related Questions