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 basic understanding of cron jobs, but I came across a tutorial today which recommends adding:

30 3 * * * wget http://www.mywebsite.com/bamboodir/index.php/recur
31 3 * * * rm -rf recur

What does the rm -rf recur do?

share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

It compensates for someone who doesn't know about the -O option for wget -- specifically, wget -O /dev/null.

More specifically, the wget call in that crontab hits a URL (presumably to trigger some sort of server-side processing -- always a sign of an absolute idiot of a web application or hosting environment). Since wget downloads files, it will store the downloaded file named recur it in the current directory. Then, a minute later, another cronjob deletes the file that was created, for tidiness.

share|improve this answer
    
Actually I believe -O to be the incorrect option... Would be -o instead –  Jeremy Bouse Aug 25 '11 at 1:26
    
@Jeremy Bouse: No; -O places the document contents somewhere, -o places the wget console output somewhere. Using -o /dev/null in scripts is possible (although -q is better), and -o /some/log/file is often useful, but is unrelated to the question. –  womble Aug 25 '11 at 1:46
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.