6

Currently, I have one php function which is running with cron. It's the function to check the timestamp and close the topic. To check the timestamp and make live update, I have to use cron. I run cron with this command

wget -q http://www.example.com/program/timecheck

Everything seems working perfectly, so I didn't check my server for quite long. But today, I checked and found out that there are more than 500,000 of files called timecheck are created at root directory.

I checked through the code and it's sure that there's no code for creating the file.

What I would like to know is, is it because of the wget -q command ? If that's what command should i use to execute the url ?

Thanks for your help.

With Regards,

1
  • wget fetches a file by default, unless you tell it not to. -q is just "quiet", which means it won't print progress upates as it fetches the file.
    – Marc B
    Commented Nov 24, 2011 at 18:16

2 Answers 2

27

Assuming this is a Linux-like OS,

wget -O /dev/null -q http://www.example.com/program/timecheck

The file is the output from wget. This option (-O) tells it to write the output to /dev/null, thus discarding it.

2
  • wget -O NUL ... on Windows.
    – netcoder
    Commented Nov 24, 2011 at 18:07
  • is the option 'O' = ZERO, or Capital O Commented May 12, 2020 at 9:57
1

yes, by default wget will save a file and it will create append version to file downloaded to avoid force replace

-q is just disable the verbose message

you can override this with :-

wget -O /tmp/log.file ${url} // this will always replace the /tmp/log.file 
1
  • Actually -q will quiet meaning it will Turn off Wget's output.
    – Mowgli
    Commented Mar 14, 2013 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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