本文介绍了的JetS3t填补了我的/ tmp目录。我应该如何删除旧文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发使用的JetS3t从S3恢复文件在Linux上某些HTTP服务器软件。这些文件都是围绕5MB。随着时间的推移,的JetS3t创建大量的在/ tmp目录下的* .tmp文件。

I'm developing some HTTP server software on Linux that uses JetS3t to retrieve files from S3. The files are all around 5MB. Over time, JetS3t creates a large number of *.tmp files in the /tmp directory.

但是,由于这是从未重新启动的服务器上所有运行时,文件永远不会扔掉。相反,他们最终填满根分区,引起了许多问题(例如丢弃HTTP连接,等等。)

However, since this is all running on a server that is never rebooted, the files never get thrown away. Instead, they eventually fill up the root partition, causing a number of problems (like dropped HTTP connections, etc.)

有没有一种方法来配置的JetS3t的方式,导致后自己清理?

Is there a way to configure JetS3t in a way that causes it to clean up after itself?

谢谢!

推荐答案

我想出了一个不雅的,但工作的解决方案。我只是简单地添加定期运行以下命令cron作业:

I came up with an inelegant, but working solution. I simply added a cron job that periodically runs the following command:

找到的/ tmp / * TMP -amin +10 -exec RM -f {} \;

基本上,查找定位所有的JetS3t的是被访问的至少10分钟前。tmp文件(感谢 -atime +10 ),然后将它们删除。

Basically, find locates all of JetS3t's tmp files that were accessed at least ten minutes ago (thanks to -atime +10) and then deletes them.

这模仿的 TM $ P $文件 tmpwatch present在某些系统上的行为。对于其他人使用这些应用程序,要小心,因为他们可能会促进某些 setuid的漏洞。我知道我的做法也可能会受到同样的漏洞,但现在我别无选择。

This mimics the behavior of tmpreaper or tmpwatch present on some systems. For others using these apps, beware, as they can facilitate some setuid exploits. I realize my approach may also be susceptible to the same exploits, but for now I have no choice.

这篇关于的JetS3t填补了我的/ tmp目录。我应该如何删除旧文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 06:38