Never used this API, but from this site: http://docs.spring.io/spring-batch-admin/reference/json.html
You can get the status of the last job (so, the one running if there is one running) with http://localhost:8080/sprin-batch-admin-sample/batch/jobs/job1.json
(replacing with job1 your actual job name and server). The parameter lastJobExecutionStatus
should be STARTING
, STARTED
or STOPPING
if it's still running.
List of possible status (check your batch version): http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/core/BatchStatus.html#STARTING
Note that the job might crash, leaving it in a state like STARTED
.
EDIT: Server-side, you can create a rest endpoint and use the SynchronizedJobLauncher
class which "synchronizes jobs globally so that only one execution of a given Job can be active at once." (http://docs.spring.io/spring-batch-admin/apidocs/org/springframework/batch/admin/launch/package-summary.html). There are many resources on how to create a rest endpoint for json, and how to inject a JobLauncher
.
Other possibilities are listed here: http://docs.spring.io/spring-batch-admin/reference/reference.xhtml