下载完成后,wget 在 exit_group 上挂起

下载完成后,wget 在 exit_group 上挂起

我正在运行 CentOS 版本 6.3(最终版)。我的服务器上的每个虚拟机都会出现此问题。通过 SSH 连接时,wget 在下载某些 URL 后挂起。

我正在运行以下命令:

wget --no-http-keep-alive -O test http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz?r=http%3A%2F%2Fwww.nagios.org%2Fdownload%2Fplugins%2F

如果我继续运行stracewget最后会得到以下输出:

clock_gettime(CLOCK_MONOTONIC, {2670737, 421643851}) = 0
write(3, "\316\206\257'\323\4\241\262\322\"\326I\236\37\327\365\27295\310\t\210\"\212$\350[\214\346\177$\320"..., 745) = 745
write(2, ".", 1.)                        = 1
write(2, " ", 1 )                        = 1
write(2, " ", 1 )                        = 1
write(2, " ", 1 )                        = 1
write(2, " ", 1 )                        = 1
write(2, " ", 1 )                        = 1
write(2, " ", 1 )                        = 1
write(2, " ", 1 )                        = 1
write(2, " ", 1 )                        = 1
write(2, " ", 1 )                        = 1
write(2, " ", 1 )                        = 1
write(2, " ", 1 )                        = 1
write(2, " ", 1 )                        = 1
write(2, " ", 1 )                        = 1
write(2, "100%", 4100%)                     = 4
write(2, "  508K", 6  508K)                   = 6
write(2, "=4.3s", 5=4.3s)                    = 5
write(2, "\n\n", 2

)                     = 2
close(5)                                = 0
time(NULL)                              = 1365435671
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=3424, ...}) = 0
time(NULL)                              = 1365435671
utime("test", [2013/04/08-12:41:11, 2012/06/27-14:39:15]) = 0
write(2, "2013-04-08 12:41:11 (478 KB/s) -"..., 692013-04-08 12:41:11 (478 KB/s) - “test” saved [2087089/2087089]

) = 69
close(2)                                = 0
close(3)                                = 0
munmap(0xb77fb000, 4096)                = 0
exit_group(0)                           = ?

据我所知,该文件已完全下载完毕。发送命令中断会杀死wget并且文件完好无损。

这非常不方便,并且会导致自动化脚本出现问题。

答案1

使用引号:

wget --no-http-keep-alive -O test "http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz?r=http%3A%2F%2Fwww.nagios.org%2Fdownload%2Fplugins%2F"

相关内容