Warning: Missing argument 2 for wp_widget() in /www/users/haoxm.net/wp-includes/widgets.php on line 76
孤独小客 » Blog Archive » CentOS 多线程下载工具 lftp(转载)

CentOS 多线程下载工具 lftp(转载)

lftp 使用方法:

# lftp -c “pget -n 10 http://www.****.com/test.tar.gz”
-c 表示断点续传
-n 10 表示10线程

lftp 安装:

# yum -y install lftp
装好后看一下
# lftp -v

LFTP | Version 3.7.11 | Copyright (c) 1996-2009 Alexander V. Lukyanov

LFTP is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with LFTP. If not, see .

Send bug reports and questions to the mailing list .

Libraries used: Readline 5.1
# man lftp

NAME
lftp – Sophisticated file transfer program

SYNTAX
lftp [-d] [-e cmd] [-p port] [-u user[,pass]] [site]
lftp -f script_file
lftp -c commands
lftp –version
lftp –help

VERSION
This man page documents lftp version 3.7.7.

DESCRIPTION
lftp is a file transfer program that allows sophisticated ftp, http and other connections to other hosts. If site is specified then lftp will connect to that site otherwise a connection has to be estab-
lished with the open command.

lftp can handle several file access methods – ftp, ftps, http, https, hftp, fish, sftp and file (https and ftps are only available when lftp is compiled with GNU TLS or OpenSSL library). You can specify the
method to use in ‘open URL’ command, e.g. ‘open http://www.us.kernel.org/pub/linux’. hftp is ftp-over-http-proxy protocol. It can be used automatically instead of ftp if ftp:proxy is set to
‘http://proxy[:port]’. Fish is a protocol working over an ssh connection to a unix account. SFtp is a protocol implemented in ssh2 as sftp subsystem.

Every operation in lftp is reliable, that is any not fatal error is ignored and the operation is repeated. So if downloading breaks, it will be restarted from the point automatically. Even if ftp server
does not support REST command, lftp will try to retrieve the file from the very beginning until the file is transferred completely.

lftp has shell-like command syntax allowing you to launch several commands in parallel in background (&). It is also possible to group commands within () and execute them in background. All background jobs
are executed in the same single process. You can bring a foreground job to background with ^Z (c-z) and back with command ‘wait’ (or ‘fg’ which is alias to ‘wait’). To list running jobs, use command ‘jobs’.
Some commands allow redirecting their output (cat, ls, …) to file or via pipe to external command. Commands can be executed conditionally based on termination status of previous command (&&, ||).

If you exit lftp when some jobs are not finished yet, lftp will move itself to nohup mode in background. The same happens when you have a real modem hangup or when you close an xterm.

lftp has builtin mirror which can download or update a whole directory tree. There is also reverse mirror (mirror -R) which uploads or updates a directory tree on server. Mirror can also synchronize direc-
tories between two remote servers, using FXP if available.

There is command ‘at’ to launch a job at specified time in current context, command ‘queue’ to queue commands for sequential execution for current server, and much more.

On startup, lftp executes /etc/lftp.conf and then ~/.lftprc and ~/.lftp/rc. You can place aliases and ‘set’ commands there. Some people prefer to see full protocol debug, use ‘debug’ to turn the debug on.
Use ‘debug 3’ to see only greeting messages and error messages.

lftp has a number of settable variables. You can use ‘set -a’ to see all variables and their values or ‘set -d’ to see list of defaults. Variable names can be abbreviated and prefix can be omitted unless
the rest becomes ambiguous.

If lftp was compiled with OpenSSL (configure –with-openssl), then it includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)

Leave a comment

Your comment