http://jira.hyperic.com/browse/HHQ-1951
The method in hq-server.sh for obtaining the value of server.java.opts in hq-server.conf is broken. Specifically, the sourcing of the TMPPROPFILE fails because the value of server.java.opts contains spaces. This failure ensures that no configuration changes to this option are ever picked up by the server.
The original function:
loadJavaOpts () {
TMPPROPFILE="${SERVER_HOME}/logs/.hq-server.conf.tmp"
cat ${SERVER_HOME}/conf/hq-server.conf | grep server.java.opts | grep -v "^#" | sed 's/./_/g' > ${TMPPROPFILE}
. ${TMPPROPFILE} 2> /dev/null
rm -f ${TMPPROPFILE}
if [ "x${server_java_opts}" = "x" ] ; then
echo "-XX:MaxPermSize=192m -Xmx512m -Xms512m"
fi
echo "${server_java_opts}"
}
Suggested replacement:
loadJavaOpts () {
server_java_opts=grep ^[ ]*server\.java\.opts ${SERVER_HOME}/conf/hq-server.conf | sed 's/[ ]*server\.java\.opts=//'
if [ -z "${server_java_opts}" ]; then
echo "-XX:MaxPermSize=192m -Xmx512m -Xms512m"
fi
echo "${server_java_opts}"
}
Note that the contents of the [ ] in the grep and sed commands above would be both a single space and a single tab (insert the tab with <ctrl-v>, then hitting tab key). This searches for any line with zero or more whitespace, followed by the server.java.opts line. This eliminates having to then "grep -v" any matches that are commented out (with a #), and matches any lines that a careless admin would have inserted with leading whitespace. Sed correspondingly looks for any leading whitespace so it can be discarded.
I also cleaned up the if test to register true for zero-length ${server_java_opts}.
All suggested code above tested under bash and ksh on Linux and AIX.
Anonymous