Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
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
add comment

3 Answers

up vote 4 down vote accepted

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.

share|improve this answer
    
Differences between wget & curl daniel.haxx.se/docs/curl-vs-wget.html –  Dax Jan 18 '13 at 10:30
add comment

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.

share|improve this answer
add comment
wget --delete-after

is the key :-)

share|improve this answer
    
Ohh, nice. I didn't know that option, i'm a curl man myself. –  Dave Cheney Mar 2 '10 at 5:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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