--- a/tomcat 2011-10-18 20:49:17.000000000 +0200
+++ b/tomcat 2012-06-06 18:56:33.000000000 +0200
@@ -28,6 +28,7 @@
# OCF_RESKEY_tomcat_suspend_trialcount - The re-try number of times awaiting a stop. Default is 10. DEPRECATED
# OCF_RESKEY_tomcat_user - A user name to start a resource. Default is root
# OCF_RESKEY_statusurl - URL for state confirmation. Default is http://127.0.0.1:8080
+# OCF_RESKEY_statusurlregex - Regex check for status URL
# OCF_RESKEY_java_home - Home directory of Java. Default is none
# OCF_RESKEY_java_opts - Options to pass to Java JVM for start and stop. Default is none
# OCF_RESKEY_catalina_home - Home directory of Tomcat. Default is none
@@ -75,7 +76,17 @@
ocf_log info "Please make sure that wget is available"
return $OCF_ERR_CONFIGURED
fi
- $WGET -O /dev/null $RESOURCE_STATUSURL >/dev/null 2>&1
+ STATUS=`$WGET -O /dev/null $RESOURCE_STATUSURL 2>&1`
+ if [ $? != 0 ]; then
+ return $OCF_ERR_GENERIC
+ fi
+ if [ "$RESOURCE_STATUSURLREGEX" != "" ]; then
+ if [[ $STATUS =~ $RESOURCE_STATUSURLREGEX ]]; then
+ ocf_log warn "Status-URL returned: $STATUS"
+ return $OCF_ERR_GENERIC
+ fi
+ fi
+ return $OCF_SUCCESS
}
############################################################################
@@ -90,9 +101,8 @@
{
isalive_tomcat ||
return $OCF_NOT_RUNNING
- isrunning_tomcat ||
- return $OCF_NOT_RUNNING
- return $OCF_SUCCESS
+ isrunning_tomcat
+ return $?
}
############################################################################
@@ -283,6 +293,14 @@
+
+
+Regex for URL check.
+
+URL regex
+
+
+
Home directory of Java.
@@ -384,6 +402,7 @@
TOMCAT_CONSOLE="${OCF_RESKEY_script_log-/var/log/$TOMCAT_NAME.log}"
RESOURCE_TOMCAT_USER="${OCF_RESKEY_tomcat_user-RUNASIS}"
RESOURCE_STATUSURL="${OCF_RESKEY_statusurl-http://127.0.0.1:8080}"
+RESOURCE_STATUSURLREGEX="${OCF_RESKEY_statusurlregex}"
JAVA_HOME="${OCF_RESKEY_java_home}"
JAVA_OPTS="${OCF_RESKEY_java_opts}"