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?


  • if you don't get much traction here, try stackoverflow.com for this question. – Patrick R Feb 23 '10 at 23:31
  • 3
    what does the crontab in question look like? – Cory J Feb 23 '10 at 23:57
  • 1
    What's the name of the file? – mpez0 Feb 24 '10 at 0:43

You need to send the output of that wget command to /dev/null if you want to avoid creating a file of the (blank) response from your php script.

Example in curl

curl -q http://your.server/script.php > /dev/null

Example in wget

wget -q -O /dev/null http://your.server/script.php

If you have the choice, you should use curl, that is a better tool for this job.


Without seeing your script, or the filename or the crontab entry it's hard to guess, but this is what I'd look at first. Try adding one or both of -o /dev/null and/or -O /dev/null to the parameters of your wget call. The first one sends stderr to the bit bucket and the second one sends the files that wget would download there. You can also use the -q switch to turn off other output. Your choice of these depends on how you're using wget.

wget --delete-after

is the key :-)

  • Ohh, nice. I didn't know that option, i'm a curl man myself. – Dave Cheney Mar 2 '10 at 5:16

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.