|
|
937446 |
diff --git a/heartbeat/tomcat b/heartbeat/tomcat
|
|
|
937446 |
index 8b7fe31..07a7ce4 100755
|
|
|
937446 |
--- a/heartbeat/tomcat
|
|
|
937446 |
+++ b/heartbeat/tomcat
|
|
|
937446 |
@@ -49,6 +49,13 @@
|
|
|
937446 |
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
|
|
|
937446 |
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
|
|
937446 |
|
|
|
937446 |
+# Use runuser if available for SELinux.
|
|
|
937446 |
+if [ -x /sbin/runuser ]; then
|
|
|
937446 |
+ SU=runuser
|
|
|
937446 |
+else
|
|
|
937446 |
+ SU=su
|
|
|
937446 |
+fi
|
|
|
937446 |
+
|
|
|
937446 |
############################################################################
|
|
|
937446 |
# Usage
|
|
|
937446 |
usage()
|
|
|
937446 |
@@ -143,7 +150,7 @@ monitor_tomcat()
|
|
|
937446 |
start_rotatelogs()
|
|
|
937446 |
{
|
|
|
937446 |
# -s is required because tomcat5.5's login shell is /bin/false
|
|
|
937446 |
- su - -s /bin/sh $RESOURCE_TOMCAT_USER \
|
|
|
937446 |
+ $SU - -s /bin/sh $RESOURCE_TOMCAT_USER \
|
|
|
937446 |
-c "$ROTATELOGS -l \"$CATALINA_BASE/logs/catalina_%F.log\" $CATALINA_ROTATETIME" \
|
|
|
937446 |
< "$CATALINA_OUT" > /dev/null 2>&1 &
|
|
|
937446 |
}
|
|
|
937446 |
@@ -154,7 +161,7 @@ rotate_catalina_out()
|
|
|
937446 |
{
|
|
|
937446 |
# Check catalina_%F.log is writable or not.
|
|
|
937446 |
CURRENT_ROTATELOG_SUFFIX=`date +"%F"`
|
|
|
937446 |
- su - -s /bin/sh $RESOURCE_TOMCAT_USER \
|
|
|
937446 |
+ $SU - -s /bin/sh $RESOURCE_TOMCAT_USER \
|
|
|
937446 |
-c "touch \"$CATALINA_BASE/logs/catalina_$CURRENT_ROTATELOG_SUFFIX.log\"" > /dev/null 2>&1
|
|
|
937446 |
if [ $? -ne 0 ]; then
|
|
|
937446 |
ocf_exit_reason "$CATALINA_BASE/logs/catalina_$CURRENT_ROTATELOG_SUFFIX.log is not writable."
|
|
|
937446 |
@@ -205,7 +212,7 @@ attemptTomcatCommand()
|
|
|
937446 |
if [ "$RESOURCE_TOMCAT_USER" = root ]; then
|
|
|
937446 |
"$TOMCAT_START_SCRIPT" $@ >> "$TOMCAT_CONSOLE" 2>&1
|
|
|
937446 |
else
|
|
|
937446 |
- tomcatCommand $@ | su - -s /bin/sh "$RESOURCE_TOMCAT_USER" >> "$TOMCAT_CONSOLE" 2>&1
|
|
|
937446 |
+ tomcatCommand $@ | $SU - -s /bin/sh "$RESOURCE_TOMCAT_USER" >> "$TOMCAT_CONSOLE" 2>&1
|
|
|
937446 |
fi
|
|
|
937446 |
|
|
|
937446 |
if [ -n "$REDIRECT_DEFAULT_CONFIG" ]; then
|