JetS3t fills up my /tmp directory. How should I remove the old files?

时间秒杀一切 提交于 2019-12-13 03:38:19

问题


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.

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

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

Thanks!


回答1:


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

find /tmp/*tmp -amin +10 -exec rm -f {} \;

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.

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.



来源:https://stackoverflow.com/questions/10391267/jets3t-fills-up-my-tmp-directory-how-should-i-remove-the-old-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!