Linux Wget中的等待功能未按预期工作

Linux Wget中的等待功能未按预期工作,linux,wget,rhel,Linux,Wget,Rhel,背景: 我正在RedhatLinux(版本7.3(Maipo))上的Bash(版本4.2.46(1))终端上使用wget(版本1.14-15.el7) 不幸的是,我仅限于此特定RHEL映像,因此无法升级到wget的更新版本 目标: 我正在尝试配置wget,以便在下载尝试失败时执行以下操作: 1) 再重试下载4次(总共5次) 2) 在两次下载尝试(“重试”)之间等待固定时间(30秒) 以下是wget手册的相关片段: -w seconds --wait=seconds Wa

背景:
我正在RedhatLinux(版本7.3(Maipo))上的Bash(版本4.2.46(1))终端上使用wget(版本1.14-15.el7)

不幸的是,我仅限于此特定RHEL映像,因此无法升级到wget的更新版本

目标:
我正在尝试配置wget,以便在下载尝试失败时执行以下操作:
1) 再重试下载4次(总共5次)
2) 在两次下载尝试(“重试”)之间等待固定时间(30秒)

以下是wget手册的相关片段:

   -w seconds
   --wait=seconds
       Wait the specified number of seconds between the retrievals.  Use of this option is
       recommended, as it lightens the server load by making the requests less frequent.
       Instead of in seconds, the time can be specified in minutes using the "m" suffix, in
       hours using "h" suffix, or in days using "d" suffix.

       Specifying a large value for this option is useful if the network or the destination
       host is down, so that Wget can wait long enough to reasonably expect the network error
       to be fixed before the retry.  The waiting interval specified by this function is
       influenced by "--random-wait", which see.

   --waitretry=seconds
       If you don't want Wget to wait between every retrieval, but only between retries of
       failed downloads, you can use this option.  Wget will use linear backoff, waiting 1
       second after the first failure on a given file, then waiting 2 seconds after the second
       failure on that file, up to the maximum number of seconds you specify.

       By default, Wget will assume a value of 10 seconds.
明确地说,我使用的是
--wait
标志,而不是
--waitretry
标志

过程:

首先,我导出/设置了错误的http_代理和https_代理,以确保任何下载尝试都会超时

我运行以下命令:
wget--trys=5--wait=30-O

此时,
--wait
功能无法按预期工作。具体来说,它不会在每次下载尝试后等待30秒

相反:
1) 第一次尝试后,它会等待1s。
2) 第二次尝试后,它将等待2秒。
3) 第三次尝试后,它将等待3秒钟。
等等

换句话说,尽管使用了
--wait
标志(这将导致下载尝试之间的固定等待时间),wget似乎正在执行
--waitretry
标志部分中描述的“线性退避”

问题:
我想要
--wait
标志的功能,而不是
--waitretry
标志


不幸的是,
--wait
标志的作用似乎类似于
--waitretry
标志——有没有办法绕过wget中这个明显的错误,因此使用
--wait
标志会导致下载尝试之间的预期固定等待时间?

如您提供的
--help
对话框所示,我相信您应该能够在命令中使用
--waitretry
,像
get--trys=5--waitretry=30-O这样的东西应该可以工作

从您提供的
--help
对话框中可以看出,我相信您应该能够在命令中使用
--waitretry
,类似于
get--trys=5--waitretry=30-O
的东西应该可以工作

关于通用计算硬件和软件的问题对于堆栈溢出来说是无关紧要的,除非它们直接涉及主要用于编程的工具。您可能会得到帮助,谢谢,我将把它移到那里。有关通用计算硬件和软件的问题对于堆栈溢出来说是离题的,除非它们直接涉及主要用于编程的工具。您可能可以获得有关“谢谢”的帮助,我将把它移到那里。谢谢,但实际上我不想要
--waitretry
提供的功能(wget执行线性退避)。我希望wget在下载尝试之间等待一段固定的时间,这应该由
--wait
标志提供,但由于某些原因,它不起作用。-
wait的使用有点像超时,因此它等待响应x秒,而不是在尝试之间睡眠。如果--wait=30,它将发送一个请求并等待30秒,然后由于超时而失败。谢谢,但实际上我不想要
--waitretry
提供的功能(wget执行线性退避)。我希望wget在下载尝试之间等待一段固定的时间,这应该由
--wait
标志提供,但由于某些原因,它不起作用。-wait的使用有点像超时,因此它等待响应x秒,而不是在尝试之间睡眠。如果--wait=30,它将发送一个请求并等待30秒,然后由于超时而失败。