title: Stop command execution after a while and execute next command in a shell script
body: <p>I want to create a script which does the following:</p>
  <ol>
  <li>Creates a Kafka server</li>
  <li>Create a topic on Kafka</li>
  <li>Start producing messages on created topic</li>
  </ol>
  <p>And my script is looks like this:</p>
  <pre><code>docker run -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=localhost --env ADVERTISED_PORT=9092 spotify/kafka
  bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic my_topic
  jq -rc . messages.json | bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic my_topic
  </code></pre>
  <p>But first command's execution process never ends and it can't go to second step. How can I understand that Kafka server is ready, and how can I execute next command after that?</p>