'I get a scheme missing error with cron

when I use this to download a file from an ftp server:

wget ftp://blah:[email protected]/"$(date +%Y%m%d -d yesterday)-blah.gz" /myFolder/Documents/"$(date +%Y%m%d -d yesterday)-blah.gz"

It says "20131022-blah.gz saved" (it downloads fine), however I get this:

/myFolder/Documents/20131022-blah.gz: Scheme missing (I believe this error prevents it from saving the file in /myFolder/Documents/).

I have no idea why this is not working.



Solution 1:[1]

Save the filename in a variable first:

OUT=$(date +%Y%m%d -d yesterday)-blah.gz

and then use -O switch for output file:

wget ftp://blah:[email protected]/"$OUT" -O /myFolder/Documents/"$OUT"
  • Without the -O, the output file name looks like a second file/URL to fetch, but it's missing http:// or ftp:// or some other scheme to tell wget how to access it. (Thanks @chepner)

  • If wget takes time to download a big file then minute will change and your download filename will be different from filename being saved.

Solution 2:[2]

In my case I had it working with the npm module http-server.

And discovered that I simply had a leading space before http://.

So this was wrong " http://localhost:8080/archive.zip".

Changed to working solution "http://localhost:8080/archive.zip".

Solution 3:[3]

In my case I used in cpanel:

wget https://www.blah.com.br/path/to/cron/whatever

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Yoraco Gonzales
Solution 3 Eduardo Leffa Abrantes