Reputation: 1
shell script code:
#!/bin/bash
cd /Users/lee/Documents/DockerValidation/
docker-compose -f docker-compose.yaml up --force-recreate --scale chrome=3 >>output.txt
Code to invoke the shell script from java
Process p = Runtime.getRuntime().exec("./docker_start.sh");
p.waitFor();
the above code triggers the shell script, and selenium hub is up. but in order for the hub to be up, the process has to keep on running. If I dont give p.waitFor() my script executes quickly and the hub is not up.
I need help with understanding on how to keep my hub up and at the same time run this process in background. Or any other alternatives to achieve my goal.
Upvotes: 0
Views: 100
Reputation: 74
You need to add this to docker-compose file
stdin_open: true
tty: true
,try again.
https://docs.docker.com/compose/reference/run
Upvotes: 0
Reputation: 1
I was trying to get my selenium hub,up and running, so that I can start executing my test cases. I did the following and it worked for me. I gave a wait time, seems it was the issue in my case.
String cmd="./docker_start.sh";
Process p = Runtime.getRuntime().exec(cmd);
p.waitFor(5,TimeUnit.SECONDS);
Upvotes: 0