【linuxコマンド】lftp scp rsync wget

4239 ワード

lftpはLinuxの下のftpクライアントで、リモートのFTPサーバにログインするために使用されます.mirrorコマンドを使用すると、ローカルのファイルをlftpでリモートFTPサーバにバックアップできます.
lftp [-d] [-e cmd] [-p port] [-u user[,pass]] [site]  lftp -f script_file  lftp -c commands  lftp --version  lftp --help

1、lftpはログインし、その後、他のコマンドラインのftpツールと同様にftp内部コマンドを使用して制御する
lftp -p 21 -u admin,123456 ftp.aaa.com
#       admin、  123456  ftp.aaa.com    ,   21。

2、lftpのmirrorコマンド、lftpログインに成功した後、mirrorコマンドを使用してファイルをバックアップします.
リモート・サーバ上のファイルをローカルにバックアップする:mirror[オプション][リモート・ディレクトリ][ローカル・ディレクトリ]
リモート・サーバへのローカル・ファイルのバックアップ:mirror-R[その他のオプション][ローカル・ディレクトリ][リモート・ディレクトリ]共通のオプション:
-c,--continue:ミラー中に接続が中断された場合、再開します.
-e,--delete:リモートサーバにないローカルファイルを削除します.
-n,--only-newer:リモートサーバ上の新しいファイルをダウンロードします.-cと一緒に使用できません.
-R,--reverse:ローカルファイルミラーをリモートサーバに転送します.
-v,--verbose[=level]:監視レベルを設定し、範囲0-3、0は出力しない、3は出力すべてを示す.
mirror [OPTS] [source [target]]
Mirror specified source directory to local target directory. If  target
directory ends with a slash, the source base name is appended to target 
directory name. Source and/or target can be URLs pointing  to  directo-
ries.

    -c, --continue      continue a mirror job if possible
    -e, --delete        delete files not present at remote site
        --delete-first       delete old files before transferring new ones
    -s, --allow-suid         set suid/sgid bits according to remote site
    --allow-chown        try to set owner and group on files
    --ignore-time        ignore time when deciding whether to download
    --ignore-size        ignore size when deciding whether to download
    --only-missing       download only missing files
    -n, --only-newer         download only newer files (-c won’t work)
    -r, --no-recursion       don’t go to subdirectories
    --no-symlinks        don’t create symbolic links
    -p, --no-perms      don’t set file permissions
        --no-umask      don’t apply umask to file modes
    -R, --reverse       reverse mirror (put files)
    -L, --dereference        download symbolic links as files
    -N, --newer-than=SPEC    download only files newer than specified time
    -P, --parallel[=N]       download N files in parallel
        --use-pget[-n=N]     use pget to transfer every single file
        --loop               loop until no changes found
    -i RX, --include RX include matching files
    -x RX, --exclude RX exclude matching files
    -I GP, --include-glob GP include matching files
    -X GP, --exclude-glob GP exclude matching files
    -v, --verbose[=level]    verbose operation
        --log=FILE      write lftp commands being executed to FILE
        --script=FILE        write lftp commands to FILE, but don’t execute them
        --just-print, --dry-run   same as --script=-
        --use-cache          use cached directory listings
        --Remove-source-files    remove files after transfer (use with caution)
    -a             same as --allow-chown --allow-suid --no-umask

lftpの-eオプションを使用します.たとえば、lftp-e「mirror-R--delete--only-newer--verbose/home/aaa.com/public_html/web/aaa.com」-p 21-u admin、123456 ftp.aaa.comログイン後、-eオプションのコマンドを自動的に実行します.
3、lftpマルチスレッドダウンロード
pget-n:使用スレッド数を設定します.-c:ブレークポイント継続.
lftp -c "pget -n 10 http://sourceforge.net/projects/kvm/files/qemu-kvm/1.2.0/qemu-kvm-1.2.0.tar.gz"
5、lftp使用問題1)lftpを使用するmirrorコマンドバックアップ時報550エラーrm:Access failed:550 dirname:Directory not empty
lftpコマンドの先頭に:set ftp:list-options-aを追加するのは、フォルダの下に隠しファイルがあり、サーバがデフォルトで表示されないため削除できません.
2)lftpタイムアウト時間と再試行回数を設定lftpコマンドの先頭に追加:set net:timeout 10;set net:max-retries 2;set net:reconnect-interval-base 5;set net:reconnect-interval-multiplier 1;
この2点を統合する最終コマンドは、lftp-e"set net:timeout 10;set net:max-retries 2;set net:reconnect-interval-base 5;set net:reconnect-interval-multiplier 1;set ftp:list-options-a;mirror-R--delete--only-newer--verbose/home/aa.com/public_html/web/aaa.com"-p 21-u admin,123456 ftp.aaa.com