I have setenv.sh file used by tomcat, I can set java otpions in this sh file.
I want to use curl to get a value capture it in a variable and use it as a java opts its not working , please help me .Here is my script
Code:
#!/bin/sh
export JAVA_HOME=/opt/java
export JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=256m"
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.ssl=false"
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.authenticate=false"
PUBLIC_DNS=curl http://169.254.169.254/latest/meta-data/public-hostname
#export PUBLIC_DNS="${PUBLIC_DNS}"
JAVA_OPTS="${JAVA_OPTS} -Djava.rmi.server.hostname=${PUBLIC_DNS}"
echo "JAVA_OPTS=${JAVA_OPTS}"
CATALINA_PID=/var/run/tomcat.pid
I am assuming PUBLIC_DNS=curl
http://169.254.169.254/latest/meta-data/public-hostname will get the value into PUBLIC_DNS , but this is always blank.
Please advice me whats wrong.