Sometimes you need to start a service that takes a while to spin up.
Solr and Selenium-RC Server, for instance, can be unavailable for several seconds after the command to start them is issued.
Using Netcat, it's easy to poll-and-wait until a newly-started service begins listening on its proper port.
- selenium-rc &
- while ! nc -vz localhost 4444; do sleep 1; done
- echo 'Selenium-RC server is open for business on port 4444!'
You need to login to post a comment.