码迷,mamicode.com
首页 > 其他好文 > 详细

Rsync 增量同步脚本(脚本一分钟,容灾备份服务器)

时间:2018-12-03 15:32:29      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:技术   echo $?   else   -o   bin   file   sha   增量   data   

#/bin/bash

author : Jerry

update : 2018-11-30

FrtIP=192.168.25.
Sip=(72 45 41 70 249 43 114)
Names=(RY72 WXJ45 LJ41 WHL70 YLJ249 WHR43 PJH114)
logs=/opt/Tools/rzbackup.log
decide() {
if [ $1 == 0 ];then
echo -e "\033[32m $2 Backup Done \033[0m" >>$logs
elif [ $1 == 23 ];then
echo -e "\033[33m $2 Backup Warning \033[0m" >>$logs
else
echo -e "\033[31m $2 Backup Failure \033[0m">>$logs
fi
echo " ">>$logs
}

echo -e "\033[36m >>>>>>>>>>ALL Begin>>>>>>date +%D‘ ‘%T>>>>>>>>>>>>> \033[0m" >>$logs
for Num in seq 0 6
do
echo "##date +%D‘ ‘%T>>>>>>## " >>$logs
echo "##${Names[$Num]} Server DB backup ...##" >>$logs
sudo /usr/bin/rsync --port=873 -vazrtopg --progress rsync@$FrtIP${Sip[$Num]}::db/* /data/idcdata/${Names[$Num]} --password-file=/etc/rsyncd.secrets &>>$logs
values=echo $?
decide $values $FrtIP${Sip[$Num]}
done
echo -e "\033[36m >>>>>>>>>>>>ALL DONE>>>>>>>date +%D‘ ‘%T>>>>>>>>>>>>>>>>>>>> \033[0m" >>$logs
技术分享图片

Rsync 增量同步脚本(脚本一分钟,容灾备份服务器)

标签:技术   echo $?   else   -o   bin   file   sha   增量   data   

原文地址:http://blog.51cto.com/jdonghong/2325317

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!