I am trying to download a file with wget
but in background and inside a screen that detaches ...
My initial command was:
wget http://www.example.com/file.zip -O temp/file.zip; mv temp/file.zip downloads/file.zip;
That would nicely move file once downloaded, preventing me from handling downloads/
files while they still download in background.
Now I need to run that in backgorund with screen, so I run and detach it:
screen -dm wget http://www.example.com/file.zip -O temp/file.zip;
But how can I still pass the move command and so that it runs when first one is completed ?
Edit: I tried quotes based on DopeGhoti's answer:
screen -dm 'wget http://mirror.leaseweb.com/speedtest/100mb.bin -O 1.bin; mv 1.bin 2.bin'
cannot identify account 'wget http:'.
and this:
screen 'wget http://mirror.leaseweb.com/speedtest/100mb.bin -O 1.bin; mv 1.bin 2.bin'
cannot exec 'wget http://mirror[...] no such file or directory
Edit: I tried with full /usr/bin/wget
and /usr/bin/mv
paths, it complains about missing session name, I gave it session name with -S foo
, now it exits silently, no such screen to resume and no files downloaded:
screen -dm -S foo '/usr/bin/wget http://mirror.leaseweb.com/speedtest/100mb.bin -O 1.bin; /usr/bin/mv 1.bin 2.bin'
screen -dm bash -c 'wget http://mirror... && mv 1.bin 2.bin'