code: @Then("^in less than '(\\d+?)' seconds, checking each '(\\d+?)' seconds, the command output '(.+?)' contains '(.+?)'( with exit status '(.+?)')?$")
      public void assertCommandExistsOnTimeOut(Integer timeout, Integer wait, String command, String search, String foo, Integer exitStatus) throws Exception {
          Boolean found = false;
          AssertionError ex = null;
          command = "set -o pipefail && alias grep='grep --color=never' && " + command;
          for (int i = 0; (i <= timeout); i += wait) {
              if (found) {
                  break;
              }
              commonspec.getLogger().debug("Checking output value");
              commonspec.getRemoteSSHConnection().runCommand(command);
              commonspec.setCommandResult(commonspec.getRemoteSSHConnection().getResult());
              try {
                  if (exitStatus != null) {
                      assertThat(commonspec.getRemoteSSHConnection().getExitStatus()).isEqualTo(exitStatus);
                  }
                  assertThat(commonspec.getCommandResult()).as("Contains " + search + ".").contains(search);
                  found = true;
                  timeout = i;
              } catch (AssertionError e) {
                  commonspec.getLogger().info("Command output don't found yet after " + i + " seconds");
                  Thread.sleep(wait * 1000);
                  ex = e;
              }
          }
          if (!found) {
              throw (ex);
          }
          commonspec.getLogger().info("Command output found after " + timeout + " seconds");
      }
docs: Checks if {@code expectedCount} text is found, whithin a {@code timeout} in the output of command {@code command}
  and the exit status is the specified in {@code exitStatus}.
  Each negative lookup is followed by a wait of {@code wait} seconds.
  
  @param timeout
  @param wait
  @param command
  @param search
  @throws InterruptedException