setenv.sh 在单独的 tomcat catalina 库中

发布于 2024-10-01 20:50:41 字数 444 浏览 4 评论 0原文

目前我有几个卡塔琳娜基地配置了以下目录,

会议 日志 服务器 网络应用程序 工作

bin、lib 和 common 目录仍然在 $CATALINA_HOME 中。

我现在需要在 bin 目录中添加一个 setenv.sh 文件,但我不希望所有 Catalina 基地都使用它。为此,我正在考虑在 catalina_base 上添加一个 bin 目录,我想要获取 setenv.sh 文件。 bin 目录将仅包含 setenv.sh 文件,而没有其他内容。其他所有内容仍将位于 $CATALINA_HOME/bin/ 中(即startup.sh catalina.sh shutdown.sh 等)

这样做有任何副作用吗? tomcat在启动时可以同时使用$CATALINA_BASE/bin/和$CATALINA_HOME/bin吗?

At the moment i have several catalina bases configured with the following directories,

conf
logs
server
webapps
work

The bin, lib and common directories are all still in $CATALINA_HOME.

I now need to add a setenv.sh file in the bin directory but i dont want it to be used by all the catalina bases. To do this i am thinking of adding a bin diretory on the catalina_base that i want to pick up the setenv.sh file. The bin directory will only contain the setenv.sh file and nothing else. Everything else will still be in $CATALINA_HOME/bin/ (ie. startup.sh catalina.sh shutdown.sh etc)

Are there any side effects to doing this? Can tomcat use both $CATALINA_BASE/bin/ and $CATALINA_HOME/bin during startup?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

很糊涂小朋友 2024-10-08 20:50:41

我还没有测试如果您提供带有 setenv.sh 的 bin 时它的行为方式。但这是我配置从一个 CATALINA_HOME 运行不同实例的许多 tomcat 应用程序的方法。

如果您有该配置,那么您可能有自己的启动脚本来运行 catalina.sh。带有选项 JAVA_HOME、CATALINA_HOME、CATALINA_BASE,可能还有 CATALINA_PID。

因此,无论您需要在 setenv.sh 中更改或添加什么,只需更改您自己的启动脚本即可。或者创建将在启动脚本开始时调用的 setenv.sh。并将其放入您自己的 bin 目录中。

我假设它是linux(在windows中它会类似)。所以你可以有一些应用程序,我们称它们为APP1、APP2。两者都有:bin conf 日志服务器 webapps 工作。目录结构可以是:

/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...

在 APP1 的 start.sh 中,您可以设置:
JAVA_HOME、CATALINA_HOME、CATALINA_BASE,可能还有 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

停止将几乎相同。您只需将开始更改为停止即可。下一步是将变量定义移动到某个文件,比如说 config.ini,然后您必须在 start.sh 和 stop.sh 中获取该文件。在windows中,需要更改export来设置。在不同的 shell 中(如果不是 bash),您需要按照说明进行操作。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文