diff校验是否需要备份文件夹

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

SYS_md5=`cat SYS_md5`
scp -pr $SYS_USER@$SYS_IP:$SYS_PATH $BACK_DIR/$DATE/
echo "进行压缩备份..."
cd $BACK_DIR/$DATE/
diff_content=1
if [ -e $BACK_DIR/$SYS_MD5 ]
then
diff_content=`diff -r $BACK_DIR/$DATE $BACK_DIR/$SYS_MD5 |wc -l`
fi
echo $diff_content $DATE $SYS_MD5
if [ $diff_content -gt 0 ] 
then
cd $BACK_DIR/$DATE/
tar --atime-preserve --preserve-order --preserve -cjf $BACK_TAR/$PRE_FIX_CONFIGS$DATE.tar.bz2 ./
cd $BACK_PATH
echo $DATE > SYS_md5
else
rm -rf $BACK_DIR/$DATE/
fi