[root@web01 ~]# rsync -avz /backup/web01_172.16.1.7_2020-08-23 rsync_backup@172.16.1.41::backup
Password: ****
sending incremental file list
web01_172.16.1.7_2020-08-23/
web01_172.16.1.7_2020-08-23/auth.txt
sent 255 bytes received 47 bytes 67.11 bytes/sec
total size is 50,999 speedup is 168.87
5) 清理数据
#模拟生成一个月数据
[root@web01 ~]# for i in {1..30};do date -s 2020/08/$i;sh /scripts/backup.sh;done
#只保留七天的文件
[root@web01 ~]# find /backup -mtime +7 | xargs rm -rf
[root@web01 ~]# ll /backup
total 0
drwxr-xr-x 2 root root 25 Aug 23 00:00 web01_172.16.1.7_2020-08-23
drwxr-xr-x 2 root root 25 Aug 24 00:00 web01_172.16.1.7_2020-08-24
drwxr-xr-x 2 root root 25 Aug 25 00:00 web01_172.16.1.7_2020-08-25
drwxr-xr-x 2 root root 25 Aug 26 00:00 web01_172.16.1.7_2020-08-26
drwxr-xr-x 2 root root 25 Aug 27 00:00 web01_172.16.1.7_2020-08-27
drwxr-xr-x 2 root root 25 Aug 28 00:00 web01_172.16.1.7_2020-08-28
drwxr-xr-x 2 root root 25 Aug 29 00:00 web01_172.16.1.7_2020-08-29
drwxr-xr-x 2 root root 25 Aug 30 00:00 web01_172.16.1.7_2020-08-30
[root@backup ~]# yum install -y mailx
#编辑邮件系统
[root@backup ~]# vim /etc/mail.rc
set from=*******@qq.com
set smtp=smtps://smtp.qq.com:465
set smtp-auth-user=*******@qq.com
set smtp-auth-password=邮箱授权码
set smtp-auth=login
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb/