rsync를 실행할 때 진행률 표시줄을 어떻게 볼 수 있나요?

rsync를 실행할 때 진행률 표시줄을 어떻게 볼 수 있나요?

rsyncUbuntu 12.04를 저장소로 사용하고 있으며 명령줄에서 사용할 때 진행률 표시줄을 보고 싶습니다 . 나는 옵션을 시도했다이 글에서 제안한( -P), 그러나 진행률 표시줄을 보고 Grsync를 사용하지 않는 것을 선호합니다. 현재 사용하고 있습니다 rsync -P source dest.

답변1

rsync에는 --info현재 진행 상황뿐만 아니라 전송 속도 및 경과 시간도 출력하는 데 사용할 수 있는 옵션이 있습니다.

--info=FLAGS            fine-grained informational verbosity

사용 방법에 대한 설명은 -P매뉴얼 페이지의 옵션 아래에 나와 있습니다.

-P     The -P option is equivalent to --partial --progress.  Its purpose is to
       make it much easier to specify these two options for a long transfer that
       may be interrupted.

       There is also a --info=progress2 option that outputs statistics based on
       the whole transfer, rather than individual files.  Use this flag
       without  out‐putting  a  filename  (e.g. avoid -v or specify --info=name0)
       if you want to see how the transfer is doing without scrolling the screen 
       with  a  lot  of names.   (You  don’t  need  to specify the --progress
       option in order to use --info=progress2.)

따라서 다음은:

rsync -r --info=progress2 --info=name0 "$src" "$dst"

다음 결과가 출력되고 지속적으로 업데이트됩니다.

18,757,542,664 100%   65.70MB/s    0:04:32 (xfr#1389, to-chk=0/1510)

전송이 시작되면 동기화를 위해 더 많은 파일이 검색됨에 따라 재귀 옵션을 사용할 때 총 청크 수와 현재 진행 상황이 변경될 수 있습니다.

답변2

--progress및 매개변수를 사용할 수 있습니다 --stats.

$ rsync -avzh --progress --stats root@server:/path/to/file output_name

root@server's password: 
receiving incremental file list
file
         98.19M  54%    8.99MB/s    0:00:08

에서매뉴얼 페이지/설명 쉘:

-a, --archive
-v, --verbose
-z, --compress
-h, --human-readable

--progress  This  option  tells  rsync to print information showing
 the progress of the transfer. This gives a bored user something to
 watch.  Implies --verbose if it wasn’t already specified.

--stats  This  tells  rsync to print a verbose set of statistics on
 the file transfer, allowing you to tell how effective rsync’s
 delta-transfer algorithm is for your data.

답변3

이건 어때?

rsync_param="-av"
rsync "$rsync_param" a/ b |\
     pv -lep -s $(rsync "$rsync_param"n a/ b | awk 'NF' | wc -l)
  • $rsync_param

    매개변수의 이중 입력 방지

  • $(rsync "$rsync_param"n a/ b | awk 'NF' | wc -l)

    완료할 단계 수를 결정합니다.

  • a/ b

    1. a/소스입니다
    2. b목표이다

답변4

이것이 마침내 효과가 있었습니다:

rsync "$rsync_param" -a --prune-empty-dirs --exclude "*.iso" rsync://archive.ubuntu.com/ubuntu/indices/ /repo/ubuntu/indices | pv -lep -s $(rsync "$rsync_param"n rsync://archive.ubuntu.com/indices/ /repo/ubuntu/indices | awk 'NF' | wc -l)

관련 정보