Skip to content

Instantly share code, notes, and snippets.

@comuttun
Created September 6, 2012 02:25
Show Gist options
  • Select an option

  • Save comuttun/3650098 to your computer and use it in GitHub Desktop.

Select an option

Save comuttun/3650098 to your computer and use it in GitHub Desktop.
Tomcat startup check (silent)
start_silent() {
echo "Starting $TOMCAT_NAME..."
if [ -f ${LOCKFILE} ]; then
echo "ERROR: LOCKFILE $LOCKFILE exists!" >&2
check_status
exit 1
fi
runuser romania -c "exec $TOMCAT_STARTUP $OPTIONS" >/dev/null 2>&1
RETVAL=$?
sleep 10
CURL_RESULT=$(curl -s --retry ${RETRY_COUNT} --connect-timeout ${CONNECTION_TIMEOUT} -o /dev/null -w '%{http_code}' $HEALTH_CHECK_URL)
CURL_RETVAL=$?
if [ $CURL_RETVAL -eq 0 ] && [ "$CURL_RESULT" = "200" ]; then
touch $LOCKFILE
echo -n "Starting $TOMCAT_NAME " && success && echo
else
echo -n "Starting $TOMCAT_NAME " && failure && echo
fi
return $RETVAL
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment