page counter next up previous contents
Next: 用法四-刪除排外 Up: Rsync 檔案備援 Previous: 基本用法二   Contents   DYWANG_HOME

用法三-檔案新舊

  1. 再一次變更,在 /home/deyu1/cron.daily/logrotate 檔案最後加入一行 'rsync test'。
    [root@kvm5 ~]# echo 'rsync test' >> /home/deyu1/cron.daily/logrotate
    
  2. 查看來源與目的端的 logrotate,目的端的檔比較新。
    [root@kvm5 ~]# ll /etc/cron.daily/logrotate /home/deyu1/cron.daily/logrotate
    -rwx------. 1 root root 180 Jul 31  2013 /etc/cron.daily/logrotate
    -rwx------. 1 root root 191 Oct 11 16:15 /home/deyu1/cron.daily/logrotate
    
  3. 執行 rsync 並增加 -u 選項,雖然來源與目的端的檔案 logrotate 不一樣,但目的端的檔案比較新,所以不會複製到目的端。
    [root@kvm5 ~]# rsync -auvh /etc/cron.daily /home/deyu1/
    sending incremental file list
    
    sent 121 bytes  received 13 bytes  268.00 bytes/sec
    total size is 1.13K  speedup is 8.43
    



De-Yu Wang 2020-05-14