如何通过bash脚本将wget作业提交给condor?

时间:2019-01-24 23:00:08

标签: bash wget condor

我在将wget作业提交给condor时遇到问题。 我可以使用wget通过命令行从url下载文件。

$ wget https://wordpress.org/latest.zip
--2019-01-24 16:43:42--  https://wordpress.org/latest.zip
Resolving wordpress.org... 198.143.164.252
Connecting to wordpress.org|198.143.164.252|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11383968 (11M) [application/zip]
Saving to: “latest.zip”

100%[======================================>] 11,383,968  --.-K/s   in 0.09s 

2019-01-24 16:43:43 (117 MB/s) - “latest.zip” saved [11383968/11383968]

但是,如果我将命令保存到bash脚本文件“ test.sh”,则如下所示:

#!/bin/sh
wget https://wordpress.org/latest.zip

然后将其提交给神鹰:

#!/usr/bin/env condor_submit
Executable = test.sh
Universe = vanilla
output = tmp.out
error = tmp.error
Log = tmp.log
Queue 1

它将显示为“连接超时”错误。

--2019-01-24 16:53:50--  https://wordpress.org/latest.zip
Resolving wordpress.org... 198.143.164.252
Connecting to wordpress.org|198.143.164.252|:443... failed: Connection timed out

但是test.sh在命令行中的运行情况如下:

$./test.sh

我将“ tesh.sh”更改为:

#!/bin/sh
wget --debug --verbose https://wordpress.org/latest.zip

输出为:

Setting --verbose (verbose) to 1
DEBUG output created by Wget 1.12 on linux-gnu.

--2019-01-24 17:25:58--  https://wordpress.org/latest.zip
Resolving wordpress.org... 198.143.164.252
Caching wordpress.org => 198.143.164.252
Connecting to wordpress.org|198.143.164.252|:443... Closed fd 3
failed: Connection timed out.

1 个答案:

答案 0 :(得分:2)

我怀疑问题出在“ https”:SSL / TLS握手失败。

如果使用Web浏览器连接到HTTPS站点,则使用浏览器的信任库(通常,它与台式机的Windows信任库是相同的。)

建议:

  1. 从命令行验证“ test.sh”是否有效。

  2. 修改您的脚本以运行wget --debug --trace ...,并检查输出。

  3. 如果仅出于故障排除目的,也请尝试--no-check-certificate

  4. 查看更多信息:

    GNU Wget 1.18 Manual


附录:

如果运行wget --debug --verbose ...,应该会看到类似以下内容的内容:

$ wget --debug --verbose https://wordpress.org/latest.zip
Setting --verbose (verbose) to 1
Setting --verbose (verbose) to 1
DEBUG output created by Wget 1.19.4 on linux-gnu.

Reading HSTS entries from /home/xxxxx/.wget-hsts
URI encoding = ‘UTF-8’
Converted file name 'latest.zip' (UTF-8) -> 'latest.zip' (UTF-8)
--2019-01-24 15:49:12--  https://wordpress.org/latest.zip
Resolving wordpress.org (wordpress.org)... 198.143.164.252
Caching wordpress.org => 198.143.164.252
Connecting to wordpress.org (wordpress.org)|198.143.164.252|:443... connected.
Created socket 3.
Releasing 0x000055afcdc64650 (new refcount 1).
Initiating SSL handshake.
Handshake successful; connected socket 3 to SSL handle 0x000055afcdc64750
certificate:
  subject: CN=*.wordpress.org,OU=Domain Control Validated
  issuer:  CN=Go Daddy Secure Certificate Authority - G2,OU=http://certs.godaddy.com/repository/,O=GoDaddy.com\\, Inc.,L=Scottsdale,ST=Arizona,C=US
X509 certificate successfully verified and matches host wordpress.org

---request begin---
GET /latest.zip HTTP/1.1
User-Agent: Wget/1.19.4 (linux-gnu)
Accept: */*
Accept-Encoding: identity
Host: wordpress.org
Connection: Keep-Alive
...

如果您不要看到此内容的任何 ...我会与您的网络管理员联系,以了解可能阻止您的Condor应用程序的防火墙或代理。 / p>