Skip to content

Commit 98c10cd

Browse files
committed
Update CLI instructions in graceful shutdown sample
1 parent 9d3011a commit 98c10cd

File tree

1 file changed

+24
-4
lines changed
  • spring-batch-samples/src/main/java/org/springframework/batch/samples/shutdown

1 file changed

+24
-4
lines changed

spring-batch-samples/src/main/java/org/springframework/batch/samples/shutdown/README.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,22 @@ gracefully, allowing it to complete its current processing before shutting down.
1414

1515
### 1. Start the job
1616

17-
First, you need to start the database server of the job repository. In a terminal, run:
17+
First, you need to start the database server of the job repository.
18+
19+
Open a terminal and run the following command from the top level directory of the project:
1820

1921
```
20-
$>cd spring-batch-samples/src/main/resources/org/springframework/batch/samples/shutdown
21-
$>docker-compose up -d
22+
$>docker-compose -f spring-batch-samples/src/main/resources/org/springframework/batch/samples/shutdown/docker-compose.yml up -d
2223
```
2324

2425
Then, run the `org.springframework.batch.samples.shutdown.StartJobExecutionApp` class in your IDE with no arguments.
26+
27+
You can also run the application from the command line using this command:
28+
29+
```bash
30+
./mvnw -pl org.springframework.batch:spring-batch-samples exec:java -Dexec.mainClass=org.springframework.batch.samples.shutdown.StartJobExecutionApp
31+
```
32+
2533
Get the process id from the first line of logs (needed for the stop):
2634

2735
```
@@ -38,6 +46,12 @@ $>kill -15 73280
3846

3947
You can otherwise run the `org.springframework.batch.samples.shutdown.StopJobExecutionApp` class in your IDE with no arguments.
4048

49+
You can also stop the execution on the command line with the following command:
50+
51+
```bash
52+
./mvnw -pl org.springframework.batch:spring-batch-samples exec:java -Dexec.mainClass=org.springframework.batch.samples.shutdown.StopJobExecutionApp
53+
```
54+
4155
You should see the shutdown hook being called:
4256

4357
```
@@ -60,12 +74,18 @@ Both the job and the step should have a `STOPPED` status.
6074

6175
Now, you can restart the job by running the `org.springframework.batch.samples.shutdown.RestartJobExecutionApp` class in your IDE.
6276

77+
Or restart the execution on the command line with the following command:
78+
79+
```bash
80+
./mvnw -pl org.springframework.batch:spring-batch-samples exec:java -Dexec.mainClass=org.springframework.batch.samples.shutdown.RestartJobExecutionApp
81+
```
82+
6383
You should see that the job is restarted from the last commit point and completes successfully.
6484

6585
## Clean up
6686

6787
To stop the database server, run:
6888

6989
```
70-
$>docker-compose down
90+
$>docker-compose -f spring-batch-samples/src/main/resources/org/springframework/batch/samples/shutdown/docker-compose.yml down
7191
```

0 commit comments

Comments
 (0)