title: Jboss EAP 6 CLI Script with commands that require reload
body: <p>I'm working on a cli script for JBoss EAP 6 (just a bunch of commands in a .bat file). </p>
  
  <p>Now I'm running into issues with commands that rely on each other, where the former sets the server to a "reload-required" state. </p>
  
  <p>For example:     </p>
  
  <ol>
  <li>first command:  remove default-datasource <code>ExampleDS</code>. Outcome: success, server in state "reload required"</li>
  <li>second command: remove h2-driver (required by default datasource). Outcome: failed, since server has not been restarted yet. </li>
  </ol>
  
  <p>I've tried to place a <code>reload</code> command in between, but it seems as if the server is not completely up when the second command gets executed. Outcome still is failed, although if I try it a few seconds later, it works. </p>
  
  <pre><code>/subsystem=datasources/data-source=ExampleDS:remove
  reload
  /subsystem=datasources/jdbc-driver=h2:remove
  </code></pre>
  
  <p>Any suggestions how to make the CLI wait until JBoss is completely up again?</p>