rsync-排除错误消息

rsync-排除错误消息

我在 crontab 中使用带有 --log-file 选项的 rsync。

如何从 rsync_out.log 文件中排除错误消息?

$ rsync -ahW ./test.txt /media/nas/mycloudex2ultra/ --log-file=rsync_out.log
rsync: [sender] link_stat "/media/usb/downloads/wdmycloud/test.txt" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1333) [sender=3.2.3]
$ cat rsync_out.log
2022/08/10 22:56:23 [140530] building file list
2022/08/10 22:56:23 [140530] rsync: [sender] link_stat "/media/usb/downloads/wdmycloud/test.txt" failed: No such file or directory (2)
2022/08/10 22:56:23 [140530] sent 24 bytes  received 17 bytes  total size 0
2022/08/10 22:56:23 [140530] rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1333) [sender=3.2.3]

我只想保留相关信息:

$ rsync -ahW ./test.txt /media/nas/mycloudex2ultra/ --log-file=rsync_out.log
$ cat rsync_out.log
2022/08/10 23:10:51 [144146] building file list
2022/08/10 23:10:51 [144146] >f+++++++++ test.txt
2022/08/10 23:10:51 [144146] sent 118 bytes  received 40 bytes  total size 6

相关内容