3

I was trying to follow the instructions from here, where trying to run the Spring Boot app as init.d service but could not successfully.

I created the fully executable jar (myapp.jar) as mentioned and also created the symlink to /etc/init.d/myapp When I run the java -jar myapp.jar I could see the application start up successfully.

But when I try to use

service myapp status it says Not running (process not found)

service myapp start it says Failed to start

the documentation says "Assuming that you have a Spring Boot application installed in /var/myapp" I don't understand this point quite well. I copied the executable jar (via Jenkins) to /var/myapp. so it contains only one file which is jar. does this create the problem?

Any suggestions are appreciated.

Environment:

springBootVersion = '1.3.2.RELEASE'
JDK6 (yes it is)
Ubuntu 12.04
jasonlam604
  • 1,456
  • 2
  • 16
  • 25
Sasi Kathimanda
  • 1,788
  • 3
  • 25
  • 47
  • Your application has not been registered as service. So you can use service command to check the status of your application. For more information check this thread http://stackoverflow.com/questions/3922554/java-running-as-a-unix-service – Pradeep Kr Kaushal Mar 07 '16 at 02:48
  • Thanks for reply.but i still dint get it right. do i need to write extra script for it ? which is not mentioned in spring doc link i cited . so where should i use $nohup java -jar program.jar & this? – Sasi Kathimanda Mar 07 '16 at 09:19
  • 1
    Actually, the spring doc is not very explicit. You also need to do the steps for "systemctl" when using "service". The official documentation for Debian "service" command is clearer: **https://wiki.debian.org/systemd/Services** Using spring documentation: **https://docs.spring.io/spring-boot/docs/current/reference/html/deployment.html#deployment-install** – Netsab612 Aug 16 '20 at 09:38

3 Answers3

8

Sometimes, you may need to run: sudo systemctl daemon-reload for your new service to be loaded.

LivePwndz
  • 600
  • 1
  • 8
  • 14
1

You must register your jar as service. Look at http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#deployment-initd-service

marok
  • 1,996
  • 1
  • 14
  • 20
1

In ubuntu you need reload deamon with sudo systemctl daemon-reload

  • 1
    [Ctrl + C] and [Ctrl + V] is not a solution, it's just a [copy of the above answer](https://stackoverflow.com/questions/35835146/spring-boot-init-d-not-not-running-process-not-found/54633150#54633150) – xKobalt Sep 04 '20 at 09:26