在wget下载之间等待

时间:2016-03-25 17:13:54

标签: shell ubuntu command-line-interface wget

我正在尝试从网站下载目录(包括子目录)。 我正在使用:

wget -r -e robots=off --no-parent --reject "index.html*" http://example.com/directory1/

问题是,服务器稍微拒绝连接,我认为在很短的时间内连接太多了。所以我想做的是在每次下载/查找之间插入一个等待时间(5秒)。那可能吗?如果是这样,怎么样?

1 个答案:

答案 0 :(得分:3)

您可以使用--wait。来自wget(1)

   -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.

我也不知道这一点,但是我使用wget联机帮助页在15秒内找到了这个答案:

  • 输入man wget
  • 您可以使用/进行搜索,因此我使用了/wait
  • 这是第一次打击!
  • q退出。