bash - 减少 wget 中的失败尝试次数
问题描述
我有一个简单的脚本,它在循环中使用 wget 直到它成功。它最终成功了,但在此之前它失败了很多次,因为它试图联系的服务器已经关闭了一段时间。如何减少我在输出中看到的“连接被拒绝”消息的数量?我尝试使用--waitretry
and--wait
标志wget
来减少 wget 尝试的次数,但我仍然看到许多“连接被拒绝”尝试。
这就是我的 wget 命令的样子:
while :; do wget -T 30 -nc --wait=30 http://193.155.44.23 && break; done
这就是我在输出中看到的:
--2021-07-19 17:52:05-- http://193.155.44.23/
Connecting to 193.155.44.23:80... failed: Connection refused.
--2021-07-19 17:52:05-- http://193.155.44.23/
Connecting to 193.155.44.23:80... failed: Connection refused.
--2021-07-19 17:52:05-- http://193.155.44.23/
Connecting to 193.155.44.23:80... failed: Connection refused.
--2021-07-19 17:52:05-- http://193.155.44.23/
Connecting to 193.155.44.23:80... failed: Connection refused.
--2021-07-19 17:52:05-- http://193.155.44.23/
Connecting to 193.155.44.23:80... failed: Connection refused.
--2021-07-19 17:52:05-- http://193.155.44.23/
Connecting to 193.155.44.23:80... failed: Connection refused.
(repeated many many times)
解决方案
推荐阅读
- raster - 关于使用 glmms 预测光栅文件
- python - 腌制的matplotlib数字失去了cartopy投影
- typescript - Realm,React Native 嵌入对象示例
- syntax - 如何在不将语法设置为纯文本的情况下禁用 SublimeREPL 中的语法突出显示?
- sql - 如何从具有大行的表中选择数据,其中列如 column1%column2
- javascript - 避免用户多次点击提交按钮?
- autohotkey - ctrl+s 未在 autohotkey 脚本中发送
- ios - Swift 5 尝试接受和解析 Firebase 动态链接和深度链接 - 出现错误,并且从不执行我的代码 - 软件导致连接中止
- postgresql - 在 PostgreSQL 中,散列子计划是什么意思?
- bash - cd 遇到问题并返回目录