【发布时间】:2012-08-18 13:40:33
【问题描述】:
我需要一个用于 s3cmd 的脚本,它为我的 Amazon S3 存储桶中的某些文件发送删除命令。我知道有this method 内置但它没有用。让我们看看为什么。
目前我有一个脚本,可以在每个午夜备份我的数据库,每个星期五和星期二(仍然在午夜)备份我的网站文件。
我正在寻找的脚本应该删除文件以便仅在存储桶上拥有:数据库和文件的每个月(假设是每个月的第一天)1 次备份。 并保留过去 7 天的所有备份(每天为 db 和周二和周五为文件,因此是“默认”行为)。
例如,如果我在 2012 年 6 月 17 日,情况应该是:
1st January 2012: db and files
1st february 2012: db and files
1st march 2912: db and files
1st april 2012: db and files
1st may 2012: db and files
10th june 2012: db
11th june 2012: db
12th june 2012: db and files
13th june 2012: db
14th june 2012: db
15th june 2012: db and files
16th june 2012: db
然后在 2012 年 7 月 2 日,存储桶应包含:
1st of jan, feb, march, apr, may, june: both db and files
last 7 days: "default" backups untouched (files backup only on tuesday and friday and db every midnight).
该脚本将自动执行我现在手动执行的操作(我上个月只有 1 次备份,因此我必须删除从 7 天前开始的备份,然后返回到上一个每月 1 日的备份)。
对不起,这个令人费解的问题,我希望它足够清楚。 :D
【问题讨论】:
标签: amazon-s3 backup cloud database-backups s3cmd