Tomcat 服务器在 tmp 中创建目录 [英] Tomcat Server creating Directories in tmp

查看:96
本文介绍了Tomcat 服务器在 tmp 中创建目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次运行我的嵌入式虚拟 tomcat 服务器(spring boot)时,它都会在 /tmp/ 中创建一个名为 tomcat.########### 的目录结构###############.8080(我猜 8080 是用于端口或其他东西,但 8080 是一致的).这种结构不会单独占用太多空间,但是在经常运行 tomcat 服务器之后,随着时间的推移,这可能会填满.作为可配置选项,我可以防止这种情况发生吗?

Everytime my embedded virtual tomcat server is ran (spring boot) it creates a directory structure in /tmp/ that is named tomcat.##########################.8080 (I am guessing 8080 is for port or something but the 8080 is consistent). This structure does not take up much space alone but after running the tomcat server often over time this can fill up. Can I prevent this from happening as a configurable option?

创建的路径示例如下所示:<代码>/tmp/tomcat.1185139485157901.8080/work/Tomcat/localhost/_/会话服务器WEB-INF/ etc. etc.

An example of the path created can look something like: /tmp/tomcat.1185139485157901.8080/work/Tomcat/localhost/_/ SESSIONS.ser WEB-INF/ etc. etc. etc.

推荐答案

遗憾的是,嵌入式和非嵌入式 Tomcat 都需要有一个目录来存储临时文件.这是不可配置的,但是,您可以使用 setBaseDir 指定 Tomcat 存储这些临时文件的目录.

Unfortunately, both embedded and non-embedded Tomcat needs to have a directory to store temporary files. This is not configurable, however, you can specify the directory in which Tomcat stores these temporary files using setBaseDir.

这应该是第一个名为 public void setBaseDir(String basedir) 的方法,如果您的代码中未指定它,它将在

This should be the first method called public void setBaseDir(String basedir) and if it is not specified in your code it will look for it in

系统属性 - catalina.base、catalina.home - $HOME/tomcat.$PORT

通过知道位置,我建议编写一个简单的计划脚本,该脚本每隔一段时间检查一次并删除该目录下的文件.

By knowing the location I recommend writing a simple scheduled script that checks every so often and removes the files under that directory.

这篇关于Tomcat 服务器在 tmp 中创建目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆