4

I've created a spring boot project and deployed it on a vm. I've added a command in local.rc that starts the spring boot application on reboot. I want to check whether the command got executed and the application is running. How do I do that?

2
  • 4
    ps -fe | grep java or something Commented Sep 12, 2018 at 7:04
  • If you find any of the provided answers useful, please mark it as "accepted" Commented Sep 16, 2018 at 7:44

2 Answers 2

10

There are two ways

  1. On system level - you can run your project as a service, which is documented in the Official documentation - Deployments. Then you can query the application status service myapp status.

  2. On application level - include Spring Boot Actuator in your app and use the Actuator endpoints such as /actuator/health as per Official documentation - Production Ready Endpoints. These endpoints can be exposed via HTTP or JMX.

Note: prior to spring boot 2.0 the actuator endpoint is /health

Sign up to request clarification or add additional context in comments.

Comments

0

If it's a web project, it makes sense to include spring-boot-actuator (just add a dependency in maven and start the microservice).

In this case, it will automatically expose the following endpoint (for example, its actually can be flexibly set up):

http://<HOST>:<PORT>/health 

Just issue an HTTP GET request, and if you get 200 - it's up and running.

If using an actuator is not an option (although it should be really addressed as a first bet), then you can merely telnet to http://<HOST>:<PORT>

The ratio behind this is that that PORT is exposed and ready to "listen" to external connections only after the application context is really started.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.