문제

I want to use below code to start the apache-tomcat,

#!/bin/bash
DUMPSPATH='/home/tomcat/dumps'
export CATALINA_OPTS='-Djava.awt.headless=true -Dfile.encoding=UTF-8 -XX:ErrorFile=$DUMPSPATH/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$DUMPSPATH'
/opt/apache-tomcat-6.0.36/bin/startup.sh

Just wanted to check if DUMPSPATH variable is used correctly in export statement or should DUMPSPATH be enclosed in curly brackets or parenthesis?

도움이 되었습니까?

해결책

If you want the content of DUMPSPATH in CATALINA_OPTS (see Variable Substitution) you have to use doublequotes not single quote:

export CATALINA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -XX:ErrorFile=$DUMPSPATH/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$DUMPSPATH"

다른 팁

As long as $DUMPSPATH is not followed by a character (such as _) that is a legal character for a parameter name, you are OK as-is. That said, it is never an error to use ${DUMPSPATH}, so feel free to use it to be on the safe side.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top