具体使用crontab与rsync结合

客户端操作     /root/2020/backup_2020-03-26.tar.gz这个压缩包已经存在
[root@xxx ~/2020]# :echo "123456" >> /etc/rsync.passwd
[root@xxx ~/2020]# :chmod 600 /etc/rsync.passwd
[root@xxx ~/2020]# :crontab -e
crontab: no changes made to crontab
You have new mail in /var/spool/mail/root
[root@xxx ~/2020]# :crontab -l
*/1 * * * * rsync -avzP --password-file=/etc/rsync.passwd /root/2020/backup_2020-03-26.tar.gz  rsync_backup@10.0.0.138::backup
服务器端查看
[root@hhh /backup]# ll
total 32
drwxr-xr-x. 2 root  root    19 Mar 30 10:44 01
drwxr-xr-x. 2 rsync rsync    6 Mar 30 21:35 0202
-rw-r--r--. 1 rsync rsync 2096 Mar 30 12:20 abc.txt
-rw-r--r--. 1 rsync rsync   11 Mar 30 08:42 a.txt
drwxr-xr-x. 2 rsync rsync   19 Mar 30 08:42 backup_2020-03-26
-rw-r--r--. 1 rsync rsync  174 Mar 30 10:35 backup_2020-03-26.tar.gz

必须严谨按照操作来,在操作过程中,是没有报错提醒的,不过会有邮件提示哪里有问题,可以cat查看一下

发布了51 篇原创文章 · 获赞 5 · 访问量 1117

猜你喜欢

转载自blog.csdn.net/weixin_46669463/article/details/105227480