首页 > 代码库 > linux备份文件脚本

linux备份文件脚本

#!/bin/sh#Author: OpalTODAY=`date +%Y%m%d`YESTERDAY=`date -d"-1 day" +%Y%m%d`mkdir -p /var/backups/etc.${TODAY}/cp -r  /etc/*  /var/backups/etc.${TODAY}/DIFF=`diff -r  /var/backups/etc.${TODAY}/ /var/backups/etc.${YESTERDAY}/`if [$DIFF = ""];then        rm -rf /var/backups/etc.${YESTERDAY}else        echo "Some file have changed!"fi