I have not tested how it behaves if you provide a bin with setenv.sh. But this is my way of configuring many tomcat applications running different instances from one CATALINA_HOME.
If you have that configuration, then you probably have your own startup script that does run catalina.sh. with options JAVA_HOME, CATALINA_HOME, CATALINA_BASE, and probably CATALINA_PID.
So whatever you need to change or to add in setenv.sh, just change in your own startup script. Or create your setenv.sh that will be called at the beggining of your start script. And put this in your own bin directory.
I assume it is linux (in windows it will be similar). So you can have a few applicaitons, lets call them APP1, APP2. Both have: bin conf logs server webapps work
. the directory structure can be:
/apps/APP1
bin
start.sh
stop.sh
conf
logs
server
webapps
work
/apps/APP2
bin
start.sh
stop.sh
conf
logs
server
webapps
work
/opt/apache-tomcat-xxx
all the standard tomcat files...
/opt/java-1.6
all the standard java files...
And in start.sh for APP1 you can set:
JAVA_HOME, CATALINA_HOME, CATALINA_BASE, and probably CATALINA_PID, CATALINA_OPTS.
export JAVA_HOME=/opt/java-1.6
export CATALINA_HOME=/opt/apache-tomcat-xxx
export CATALINA_BASE=/apps/APP1
export CATALINA_PID=${CATALINA_BASE}/temp/app1.pid.file
export CATALINA_OPTS=-Dmy.fancy.variable=hello
${CATALINA_HOME}/bin/catalina.sh start
Stop will be almost the same. You only need to change start to stop. next step will be to move variable definitions to some file, let's say config.ini and then you have to source this file in start.sh and also in stop.sh. In windows, you need to change export to set. In different shells (if not bash) you need to follow the instructions.