从 bash 脚本调用 wget 和 curl 时速度要慢得多

发布于 2024-10-14 01:51:46 字数 431 浏览 13 评论 0原文

我正在编写一个小自动化脚本,我需要下载一个文件。当我直接从 bash 使用curl 或 wget 时,平均 dl 速度约为 3MB/s。然而,当我从 bash 脚本调用它时,下载速度下降到 300kB/s。对于curl 和wget 都会发生这种情况。

我在 OS X 上,使用 bash 3.2.48、wget 1.12 和curl 7.19.7

编辑:脚本 - 到目前为止只是这个片段。我刚刚尝试了一下,发现了这个问题...

#!/bin/bash
CURVER=1.0
VERSION=1.2


if [ ${VERSION//\./} -gt ${CURVER//\./} ]; then
    echo "There is a new version available!"

    wget -O /tmp/dl.dmg $DOWNLOAD

fi

I'm writing a little automation script and I need to download one file. When I use curl or wget directly from bash, the average dl speed is about 3MB/s. However, when I invoke it from the bash script, the download speed drops to 300kB/s. It happens for both curl and wget.

I'm on OS X, with bash 3.2.48, wget 1.12 and curl 7.19.7

EDIT: the script - it's just this snippet so far. I just tried it and found that issue...

#!/bin/bash
CURVER=1.0
VERSION=1.2


if [ ${VERSION//\./} -gt ${CURVER//\./} ]; then
    echo "There is a new version available!"

    wget -O /tmp/dl.dmg $DOWNLOAD

fi

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

_蜘蛛 2024-10-21 01:51:46

非常奇怪!

您执行脚本的用户是否与从命令行尝试使用的用户相同?

也许该脚本是由具有某种会减慢连接速度的策略的用户运行的?

EXTREMELY WEIRD!

Are you executing the script with the same user than the one you use to try it from command line?

Maybe the script is ran by a user with some type of policy that slowdown connection?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文