美文网首页
删除S3 rdb 脚本

删除S3 rdb 脚本

作者: HelloWorld_26 | 来源:发表于2018-06-21 17:29 被阅读0次

    m_region='cn-north-1'
    base_url='backup/rdb/'
    ndate=date +%Y%m%d --date "-10 days"

    for each_bak_dir in aws --region ${m_region} s3 ls s3://${base_url} |grep PRE |grep -v current |awk '{print $2}' |sed 's#/##g';do
    echo ${each_bak_dir}
    each_bak_dir_num=echo ${each_bak_dir} | sed 's/-//g'
    if [ ${each_bak_dir_num} -lt ${ndate} ];then
    #echo ${each_bak_dir}
    for del_time in seq -w 00 23 |egrep -v "10|12";do
    #echo ${each_bak_dir}/${del_time}/
    #aws --region ${m_region} s3 rm s3://${base_url}2017-08-15/00/ --recursive
    aws --region ${m_region} s3 rm s3://${base_url}${each_bak_dir}/${del_time}/ --recursive
    done
    fi
    done

    相关文章

      网友评论

          本文标题:删除S3 rdb 脚本

          本文链接:https://www.haomeiwen.com/subject/yedcyftx.html