Bc_connect app: Wait for process to start before displaying Connect

For a batch connect / interactive app: How would I wait for the process started in template/script.sh to reach a checkpoint before displaying the Connect button for the user?

For example, a web service like Galaxy takes a long time to start up. If the user immediately hits Connect, the server is not running yet.

Hi and thanks for the question.

The trick here will be to use the after.sh script.

What is happening is OOD is waiting for that connection.yml file to be written before it displays the connect button for the user, and this is in turn waiting on things like the port to be open. But, clearly more time is needed to connect for this app than just waiting for the port to open and the connection.yml to be written.

I’d recommend trying to find out a definitive part of Galaxy that you can issue a shell command to know if it is in fact up and running, or use something like sleep to wait some known safe period of time, in that after.sh script to handle this.

OK, thanks. I think this may work in after.sh (assuming $srv_url has been exported by before.sh):

# wait for the Galaxy gunicorn process to be ready
timeout 30 grep -q "Listening at: $srv_url" <(tail -f output.log)