问题描述
我创建了一个shell脚本备份我的webfiles +数据库转储,把它变成一个tar归档和异地FTP它们。我还想运行X按周次但是我只想保留最新的10备份在FTP站点。
I have created a shell script to backup my webfiles + database dump, put it into a tar archive and FTP it offsite. Id like to run it X times per week however I only want to keep the latest 10 backups on the FTP site.
我怎么能这样做最好?我应该做的shell脚本侧这项工作,或者是有一个FTP命令来检查最后修改和管理的事情呀?
How can I do this best? Should I be doing this work on the shell script side, or is there an FTP command to check last modified and admin things that way?
任何意见将是AP preciated。
Any advice would be appreciated.
谢谢,
推荐答案
做这样的事情是使用一周中的一天,在文件名的方法之一:
One way to do something like this would be to use the day of the week in the filename:
- 备份mon.tgz
- 备份tue.tgz
- 等
然后,当你的备份,你可以删除或覆盖备份文件本周的当前天。
Then, when you backup, you would delete or overwrite the backup file for the current day of the week.
(当然,这样你只能得到最新的7档,但它是一个pretty简单的方法)
(Of course, this way you only get the latest 7 files, but it's a pretty simple method)
这篇关于FTP - 只需要保留最新的10个文件 - 删除LRU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!