标签:shell脚本
#/bin/bash
work_home=/data
olddata_home="${work_home}/olddata"
target_day=`date -d "-3 day" +%F`
#打包前3天的日期目录压缩成功后并删除
tar -zcvf ${olddata_home}/$target_day.tar.gz ${olddata_home}/$target_day
if [ $? -eq 0 ];then
echo "The $i is Compression success"
rm -rf ${olddata_home}/$target_day
else
echo " The $i is not Compression success"
#break
fi
本文出自 “杨玉贺” 博客,请务必保留此出处http://10302043.blog.51cto.com/10292043/1971444
shell脚本将指定目录下前3天日期目录使用tar打包后并将其删除源日期目录
标签:shell脚本
原文地址:http://10302043.blog.51cto.com/10292043/1971444