Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is cron command wget -q create file at server?

Tags:

cron

wget

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,

like image 902
spotlightsnap Avatar asked Nov 24 '11 17:11

spotlightsnap


2 Answers

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.

like image 51
Dark Falcon Avatar answered Oct 13 '22 19:10

Dark Falcon


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 
like image 33
ajreal Avatar answered Oct 13 '22 19:10

ajreal