使用 cron 作业定期清除 phpThumb 缓存
我在客户端网站上使用 phpThumb,由于它是一个图像非常重的应用程序,因此缓存很快就会变得巨大。今天,拇指停止工作,我重命名了缓存文件夹,因为该文件夹太大,无法通过 ftp 删除。我将其重命名为cache_old,现在尝试通过 ssh 删除它。我重新创建了缓存文件夹,一切都恢复正常。
由于当缓存文件夹太满时它似乎会停止工作,而且为了保持服务器整洁,我想设置一个每日 cron 作业来清除缓存文件夹中的文件。我不知道如何做到这一点,但还没有找到答案。
缓存文件夹中有一个名为index.php的文件,我认为需要保留它,再加上一个名为source的子文件夹,它又有一个名为index.php的文件,我再次认为需要在那里。所以我需要一个命令来删除除这些文件之外的所有内容。
任何有关如何设置的指导将不胜感激!
谢谢, 克里斯汀
·P.S.该网站托管在 DreamHost 上,我已经通过 cronjob 面板设置了其他作业,并且如果设置更容易的话,我确实具有 SSH 访问权限。干杯!!
I am using phpThumb on a client website, and as it is a very image heavy application the cache gets huge quick. Today the thumbs stopped working and I had rename the cache folder, as the folder was too big to delete via ftp. I renamed it cache_old and am trying to delete it now via ssh. I recreated the cache folder and everything worked fine again.
Since it seems it stops working when the cache folder is too full, plus just to keep the server tidy, I would like to setup a daily cron job to clear files from the cache folder. I have no idea how to do this though and haven't been able to find an answer yet..
The cache folder has a file in it called index.php which I assume needs to stay, plus a sub folder called source, which again has a file called index.php, again I assumed that needs to be there. So I need a command that will delete everything BUT those files.
Any guidance on how to set this up would be appreciated!
Thanks,
Christine
P.S. The site is hosted on DreamHost, and I have set other jobs up via there cronjob panel, and I do have SSH access if setting it up that way is easier. Cheers!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可以用一个命令来完成此操作,但更明显。
或者在一个 cron 作业中
it's possible to do this in one command but it's more obviously.
or in one cron job