<commit_before>#!/bin/bash


##This needs to get refactored so that there is not so much duplication in each uber if statement
Host=$1
startedSignal="INFO: Server startup"

timeout () {
  sleep 1
  count=$((count+1))
  if [ ${count} == 180 ];
    then
    echo "Waited for 3 minutes and Tomcat has not started."
    echo "Check /var/log/tomcat7/catalina.out to see what is happening."
    exit 1
  fi

}

checkForStartup() {

  echo "Waiting for OpenMRS to start.  This could take a few minutes."
  while [ -z "${result}"  ];
    do
      if [ "${Host}" == "devtest01.openmrs.org" ]
        then
          result=`ssh -o StrictHostKeyChecking=no devtest01.openmrs.org "sudo tail /var/log/tomcat7/catalina.out | grep \"${startedSignal}\""`
        timeout
        else
          result=`tail /var/log/tomcat7/catalina.out | grep "${startedSignal}"`
        timeout
      fi
done
  echo "Tomcat started."
  echo "OpenMRS Reference Application is ready for use."
}

checkForStartup $1<commit_msg>Breeze: RA-114 setting timer on app startup to get a more precise idea of startup time<commit_after>#!/bin/bash


##This needs to get refactored so that there is not so much duplication in each uber if statement
Host=$1
startedSignal="INFO: Server startup"

timeout () {
  sleep 1
  count=$((count+1))
  if [ ${count} == 180 ];
    then
    echo "Waited for 3 minutes and Tomcat has not started."
    echo "Check /var/log/tomcat7/catalina.out to see what is happening."
    exit 1
  fi

}

checkForStartup() {

  echo "Waiting for OpenMRS to start.  This could take a few minutes."
  while [ -z "${result}"  ];
    do
      if [ "${Host}" == "devtest01.openmrs.org" ]
        then
          result=`ssh -o StrictHostKeyChecking=no devtest01.openmrs.org "sudo tail /var/log/tomcat7/catalina.out | grep \"${startedSignal}\""`
        timeout
        else
          result=`tail /var/log/tomcat7/catalina.out | grep "${startedSignal}"`
        timeout
      fi
  done
  echo "Tomcat started in ${count} seconds."
  echo "OpenMRS Reference Application is ready for use."
}

checkForStartup $1
{'fraction_non_alphanumeric': 0.1158097068716963, 'fraction_numerical': 0.016818837097549257, 'mean_word_length': 2.869888475836431, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '611249', 'n_tokens_mistral': 714, 'n_tokens_neox': 654, 'n_words': 225}