I have a php script I want to run every minute to see if there are draft news posts that need to be posted. I was using “wget” for the cron command in cPanel, but i noticed (after a couple days) that this was creating a blank file in the main directory every single time it ran. Is there something I need to stop that from happening?
Thanks.
When wget runs, by default, it generates an output file, from what I need to remember.
You probably need to use some option of wget, to specify to which file it should write its output — and use
/dev/nullas destination file (It’s a “special file” that will “eat” everything you can write to it)Judging from man wget, the
-Oor--output-fileoption would be a good candidate :-O file--output-document=fileThe documents will not be written to the appropriate files, but all will be concatenated together and written to file.
so, you might need to use something like this :
And, btw, the output of scripts run from the crontab is often redirected to a logfile — it can always help.
Something like this might help, about that :
And you might also want to redirect the error output to another file (can be useful, to help with debugging, the day something goes wrong) :