Reputation: 3069
I must launch 2 instances of tomcat on a server and with the same user. I'm trying to set differents CATALINA_BASE when launching tomcat but this environment variable is not used.
That is the commands I use:
base0=/home/$INT/inst0
base1=/home/$INT/inst1
#...
su $INT -c "CATALINA_BASE=$base0;$cathome/bin/startup.sh"
su $INT -c "CATALINA_BASE=$base1;$cathome/bin/startup.sh"
and that is what I see in the console:
Using CATALINA_BASE: /home/mci2/tomcat
Using CATALINA_HOME: /home/mci2/tomcat
Using CATALINA_TMPDIR: /home/mci2/tomcat/temp
The catalina_home is ok but not the catalina_base.
Dit I miss something?
Upvotes: 1
Views: 156
Reputation: 81
You should use single quotes:
su -c "var=Hello; echo $var"
vs
su -c 'var=Hello; echo $var'
The shell interpretes the variables inside the double quotes, and having that you have not set the CATALINA_BASE
for the env from which you execute su
it replaces it with and empty string before actually executing the su
.
Upvotes: 1
Reputation: 743
If you are running multiple instances of Tomcat on a single host you should set CATALINA_BASE to be equal to the .../tomcat_instance1 or .../tomcat_instance2 directory as appropriate for each instance and the CATALINA_HOME environment variable to the common Tomcat installation whose files will be shared between the two instances. tomcat - CATALINA_BASE and CATALINA_HOME variables
Upvotes: 0