Lopakhin
Lopakhin

Reputation: 299

Spring Boot Service unrecognized

I build my spring-boot application with version Spring Boot 1.4.1 on Ubuntu 14.04 and using executable build option. The final jar file is ok to run as a single executable.

I try to use following command ln -s xxxx.jar /etc/init.d/coachService to create a service.

When I try to start service using service coachService start, it tells me "unrecognized service".

I checked the jar permission , it has execute permission.

Please tell me what's going wrong.

Thanks.

Upvotes: 0

Views: 2097

Answers (3)

Hoang
Hoang

Reputation: 857

I found solution that give permission for file jar before do follow of guide spring. You run command line:

sudo chmod +x myapp.jar

Then run

$ sudo ln -s /var/myapp/myapp.jar /etc/init.d/myapp

$ service myapp start

This solution I found here

Hope help you.

Upvotes: 2

Ishiido
Ishiido

Reputation: 29

I ran into the same problem. As far as I can see it has nothing to do with where the jar file is situated, but it has to be executable. That solved the problem for me. The newer documentation of spring reads

Assuming that you have a Spring Boot application installed in /var/myapp

this I understand as the listing of an example, not a rule. My applications live under /opt/application and not in /var.

Upvotes: 0

Patrick
Patrick

Reputation: 12734

Like the documentation says, you should have your application installed in /var/myApp

Assuming that you have a Spring Boot application installed in /var/myapp, to install a Spring Boot application as an init.d service simply create a symlink:

$ sudo ln -s /var/myapp/myapp.jar /etc/init.d/myapp

Once installed, you can start and stop the service in the usual way. For example, on a Debian based system:

$ service myapp start

Just install the application in the right place and rename myapp with your appname and service.

Upvotes: 2

Related Questions