I need to download a file when my computer boots up, so I created this line in my cronjob:

@reboot wget -a /log/here -O /save/here https://domain.tld/file.ext

Unfortunately, it creates a blank file at /save/here and gives me an error at /log/here.

The error says:

Resolving domain.tld (domain.tld)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ■domain.tld■

Is this because name resolution isn't available so early in the boot process? Besides replacing the domain with an ip address bypassing name resolution, is there anything else I can do? I'd like to keep this all within the crontab.

2 Answers 2


Use a unit file with dependency of network, or you can try this :

@reboot until ping -c1 dk &>/dev/null; do sleep 2; done; wget -a /log/here -O /save/here https://domain.tld/file.ext

(dk is the shortest domain name I know)

  • Thank you. I tried the above and it still didn't resolve. Then I setup my domain with an ip address and it still didn't work (it worked in the browser on another computer but my wget log it said: failed: Network is unreachable). Now I'm trying to figure out the systemd unit file with dependency of network, but having a hard time finding examples.
    – GFL
    Dec 26, 2019 at 20:52
  • 1
    1) what is your distro ? 2) is ping dk works in terminal ? Dec 26, 2019 at 23:30
  • 1
    Would need to ping an ip address like so it does not fail early on name resolution Dec 27, 2019 at 1:26
  • 1
    just keep on trying wget. @reboot until wget -a /log/here -O /save/here https://domain.tld/file.ext; do sleep 2; done
    – Jasen
    Dec 27, 2019 at 4:53
  • @GillesQuenot its Raspbian
    – GFL
    Dec 31, 2019 at 6:26

I found that the most reliable way to use wget at bootup was to create a job in /etc/rc.local. Also, as the computer I was using doesn't have an internal battery and instead relies on Network Time Protocol to set its clock on boot up, I found that I had to also specify the --no-check-certificate or not use https:// to prevent the command from failing due issues such as the SSL certificate not being valid yet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.