如何延迟wget进度条更新/刷新间隔?
默认情况下,它每毫秒更新一次,当在作业脚本中运行导致作业脚本STDOUT文件变大时,每个更新将作为单行捕获到STDOUT文件。我不想完全禁用进度条,因为我仍然想知道不同时间的进度。
答案 0 :(得分:6)
wget
知道--progress
选项,它允许您稍微调整输出设置。摘录自该联机帮助页:
--progress=type
Select the type of the progress indicator you wish to use. Legal indicators are
"dot" and "bar".
[...]The "bar" indicator is used by default. It draws an ASCII progress bar graphics
(a.k.a "thermometer" display) indicating the status of retrieval. If the output is
not a TTY, the "dot" bar will be used by default.
Use --progress=dot to switch to the "dot" display. It traces the retrieval by
printing dots on the screen, each dot representing a fixed amount of downloaded data.
The progress type can also take one or more parameters. The parameters vary based on
the type selected. Parameters to type are passed by appending them to the type
sperated by a colon (:) like this: --progress=type:parameter1:parameter2.
When using the dotted retrieval, you may set the style by specifying the type as
dot:style. Different styles assign different meaning to one dot. With the "default"
style each dot represents 1K, there are ten dots in a cluster and 50 dots in a line.
The "binary" style has a more "computer"-like orientation---8K dots, 16-dots clusters
and 48 dots per line (which makes for 384K lines). The "mega" style is suitable for
downloading large files---each dot represents 64K retrieved, there are eight dots in
a cluster, and 48 dots on each line (so each line contains 3M). If "mega" is not
enough then you can use the "giga" style---each dot represents 1M retrieved, there
are eight dots in a cluster, and 32 dots on each line (so each line contains 32M).
With --progress=bar, there are currently two possible parameters, force and noscroll.
When the output is not a TTY, the progress bar always falls back to "dot", even if
--progress=bar was passed to Wget during invokation. This behaviour can be overridden
and the "bar" output forced by using the "force" parameter as --progress=bar:force.
By default, the bar style progress bar scroll the name of the file from left to right
for the file being downloaded if the filename exceeds the maximum length allotted for
its display. In certain cases, such as with --progress=bar:force, one may not want
the scrolling filename in the progress bar. By passing the "noscroll" parameter,
Wget can be forced to display as much of the filename as possible without scrolling
through it.
Note that you can set the default style using the "progress" command in .wgetrc.
That setting may be overridden from the command line. For example, to force the bar
output without scrolling, use --progress=bar:force:noscroll
我建议阅读整篇文章,了解wget
进度表的工作原理,但简而言之,这些是重点:
wget
将使用dot
显示方法dot
显示方法显示每下载X个字节数.
--progress=dot:<style>
传递给wget
来电style
可以是以下之一:
default
:每点1KB binary
:每个点8KB mega
:每个点64KB giga:
每个点1MB 总结一下,为了减少下载大文件时的输出,你可以按如下方式调用wget:
$> wget --progress=dot:mega <url>