Entering edit mode
6.7 years ago
Ana
▴
200
My question is somehow related to what I asked yesterday. C: downloading bam files of phase 3 of 1000 genomes project
I am trying to download bam files of 1000 genomes project, only for my desired intervals by incorporating samtools -view. As it takes probably more than a day, I want to run it in the background, this is the code that I am using so far (I used & in the end of my code):
wget -q -O - "ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/current.tree" | cut -f 1 | grep '.bam$' | while read B; do echo -n "$B " && /data/programs/samtools-1.3.1/samtools view -bu "http://ftp.1000genomes.ebi.ac.uk/vol1/$B" "1:115258827-115258827" && rm *.chrom20.* && rm *.chrom11.* ; done &
I also tried (& disown)
wget -q -O - "ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/current.tree" | cut -f 1 | grep '.bam$' | while read B; do echo -n "$B " && /data/programs/samtools-1.3.1/samtools view -bu "http://ftp.1000genomes.ebi.ac.uk/vol1/$B" "1:115258827-115258827" && rm *.chrom20.* && rm *.chrom11.* ; done & disown
However, when I logout, my jobs terminate. My question is how can I download files and run my command that I mention above in the background?
Have a look at GNU screen to run processes in the background. IMHO one of the most useful GNU application, I use it like every day.
look into wrapping your command in
nohup
and&
option
-b
activates running wget in background modeyou might also try to execute your cmdline as such
so use () to 'encapsulate' your cmdline. I'm doubting the behaviour of the
&
on a piped cmdline