I am using bellow to run a page every hour in my Virtualmin installed on CentOS 7

wget https://domain.tld/index.php?page=cron > /dev/null 2>&1

but it creates below files every hour when cron run



Please let me know how to avoid creation of these file.

  • You are fetching a web page, but you don't want to actually store it? – Kusalananda Apr 20 '18 at 5:43
  • Yes, I don't need output of the page. – DMP Apr 20 '18 at 5:45

wget, by default, saves the fetched web page in a file whose name corresponds to the document at the end of the URL (it does not send it to its standard output). If that file already exists, it adds a number to the end of the name.

If you don't want to save the document, then specify that you'd like to save it in /dev/null:

wget -O /dev/null 'https://domain.tld/index.php?page=cron' >/dev/null 2>&1


wget --output-document=/dev/null --quiet 'https://domain.tld/index.php?page=cron'

It's also a good idea to quote the URL as URLs sometimes contain characters that may be interpreted a filename globbing character or command terminators by the shell (like & and [ and ] etc.).


The problem isn't with cron. This is wget's default behavior. To make it redirect to standard out (so you can then sink that output to /dev/null), use wget -O-. And, you probably also want -q. So:

wget -qO- 'https://domain.tld/index.php?page=cron' > /dev/null 2>&1

I don't really recommend this approach, though. What if there's an error? It's better to make a small script which checks that the result is an http 200 code, and that the contents are as expected.

  • Thank you for reply and recommendation, actually errors are handled somewhere else so I don't need any kind of output at all. Can you tell me what is -q here? – DMP Apr 20 '18 at 6:01
  • @DMP -q is the same as --quiet (see man wget). – Kusalananda Apr 20 '18 at 7:14

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.