连接错误,使用shell脚本中的wget

huangapple go评论66阅读模式
英文:

Connection Error with wget in shell script

问题

以下是您的脚本的翻译部分:

#!/bin/bash

WGETREF='https://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/reference/GRCh38_reference_genome/GRCh38_full_analysis_set_plus_decoy_hla.fa'

wget $WGETREF
chmod +x get-ref.sh

我这样调用它:

sbatch -A OD-projectID get-ref.sh

我尝试创建这个脚本是因为我需要下载很多相似的文件,它们都超过30 GB。但是,当我直接在命令行中使用wget时,它会开始下载,正常工作。但是,使用Shell脚本时,输出文件给我以下错误:

Connecting to ftp.1000genomes.ebi.ac.uk (ftp.1000genomes.ebi.ac.uk)|193.62.193.140|:443... failed: Connection refused.

我应该在我的脚本中添加什么?

我尝试了不同的写法,例如调用第二个脚本如下:

#!/bin/bash
wget -i url-ref.txt

其中url-ref.txt是一个包含URL的简单文本文件。

Bash版本:GNU bash, version 4.4.23(1)-release (x86_64-suse-linux-gnu)。

这是调试输出的内容:

DEBUG output created by Wget 1.20.3 on linux-gnu.

Reading HSTS entries from /home/foa003/.wget-hsts
URI encoding = ‘UTF-8’
asking libproxy about url 'https://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/reference/GRCh38_reference_genome/GRCh38_full_analysis_set_plus_decoy_hla.fa'
libproxy suggest to use 'direct://'
Converted file name 'GRCh38_full_analysis_set_plus_decoy_hla.fa' (UTF-8) -> 'GRCh38_full_analysis_set_plus_decoy_hla.fa' (UTF-8)
--2023-05-18 11:36:52--  https://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/reference/GRCh38_reference_genome/GRCh38_full_analysis_set_plus_decoy_hla.fa
Resolving ftp.1000genomes.ebi.ac.uk (ftp.1000genomes.ebi.ac.uk)... 193.62.193.140
Caching ftp.1000genomes.ebi.ac.uk => 193.62.193.140
Connecting to ftp.1000genomes.ebi.ac.uk (ftp.1000genomes.ebi.ac.uk)|193.62.193.140|:443... Closed fd 3
failed: Connection refused.
Releasing 0x00005555558eb020 (new refcount 1).

我尝试在wget之前添加ping google.com,似乎可以工作。

希望这些信息有所帮助。

英文:

This is what my script looks like :

#!/bin/bash

WGETREF='https://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/reference/GRCh38_reference_genome/GRCh38_full_analysis_set_plus_decoy_hla.fa'

wget $WGETREF
chmod +x get-ref.sh

I call it like so :

sbatch -A OD-projectID get-ref.sh

I tried doing a script because I will have to download lots of similar files that are 30+ Gb.
When doing wget directly in the command line, it starts the download as it should. However with the shell script, the output file gives me the following error :

Connecting to ftp.1000genomes.ebi.ac.uk (ftp.1000genomes.ebi.ac.uk)|193.62.193.140|:443... failed: Connection refused.

Is there something I should add to my script ?

I tried different ways of writing the wget for instance calling for a 2nd script as so :

#!/bin/bash
wget -i url-ref.txt

with url-ref.txt being a simple text file with just the url.

Bash version : GNU bash, version 4.4.23(1)-release (x86_64-suse-linux-gnu).

This is what the debug output says :

DEBUG output created by Wget 1.20.3 on linux-gnu.

Reading HSTS entries from /home/foa003/.wget-hsts
URI encoding = ‘UTF-8’
asking libproxy about url 'https://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/reference/GRCh38_reference_genome/GRCh38_full_analysis_set_plus_decoy_hla.fa'
libproxy suggest to use 'direct://'
Converted file name 'GRCh38_full_analysis_set_plus_decoy_hla.fa' (UTF-8) -> 'GRCh38_full_analysis_set_plus_decoy_hla.fa' (UTF-8)
--2023-05-18 11:36:52--  https://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/reference/GRCh38_reference_genome/GRCh38_full_analysis_set_plus_decoy_hla.fa
Resolving ftp.1000genomes.ebi.ac.uk (ftp.1000genomes.ebi.ac.uk)... 193.62.193.140
Caching ftp.1000genomes.ebi.ac.uk => 193.62.193.140
Connecting to ftp.1000genomes.ebi.ac.uk (ftp.1000genomes.ebi.ac.uk)|193.62.193.140|:443... Closed fd 3
failed: Connection refused.
Releasing 0x00005555558eb020 (new refcount 1).

I tried adding ping google.com before wget and it seems to work

答案1

得分: 1

wget之前添加ping google.com有所帮助。

英文:

Adding ping google.com before wget helped

huangapple
  • 本文由 发表于 2023年5月18日 08:07:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/76276931.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定