我用这个脚本下载文件。没有-b,wget逐个下载文件。有了-b,我可以在后台同时下载文件。不幸的是,这个脚本在SLURM中不起作用。它只在Slurm中不使用-b即可工作。
下载文件的脚本
#!/bin/bash
mkdir data
cd data
for i in 11 08 15 26 ;
do
wget -c -b -q ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR116/0${i}/SRR116802${i}/SRR116802${i}_1.fastq.gz
wget -c -b -q ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR116/0${i}/SRR116802${i}/SRR116802${i}_2.fastq.gz
done
cd ..Slurm脚本
#!/bin/bash
#SBATCH --job-name=mytestjob # create a short name for your job
#SBATCH --nodes=2 # node count
#SBATCH --ntasks=2 # total number of tasks across all nodes
#SBATCH --cpus-per-task=2 # cpu-cores per task (>1 if multi-threaded tasks)
#SBATCH --mem-per-cpu=4G # memory per cpu-core (4G is default
#SBATCH --time=10:01:00 # total run time limit (HH:MM:SS)
#SBATCH --array=1-2 # job array with index values 1, 2
#Execution
bash download.sh终端上的:sbatch slurmsript.sh (它不起作用) no jobid
发布于 2021-01-17 23:32:27
您可以使用curl同时下载多个文件。
就你的情况而言,这应该是可行的:
# Create an empty bash array of urls.
urls=()
# Add each url to the array, such that '-O' and the url are separate
# items in the array. This is necessary so that the curl command will
# look like 'curl -O <url1> -O <url2> ...', since the -O command must
# be provided for each url.
for i in 11 08 15 16; do
urls+=( "-O" "ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR116/0${i}/SRR116802${i}/SRR116802${i}_1.fastq.gz" )
urls+=( "-O" "ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR116/0${i}/SRR116802${i}/SRR116802${i}_2.fastq.gz" )
done
# Simultaneously download from all urls.
curl --silent -C - "${urls[@]}"要解释每个curl选项:
--silent是wget的-q。禁用curl的进度meter.-C -相当于wget的-c。它告诉curl自动查找在哪里/如何恢复transfer.-O告诉curl将输出写入与远程文件同名的文件(这是wget的行为)。这必须为每个url指定。f 221
或者,您可能需要考虑安装和使用aria2。
https://stackoverflow.com/questions/65759481
复制相似问题