3

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?

womble
  • 96,255
  • 29
  • 175
  • 230
John Magnolia
  • 1,723
  • 6
  • 28
  • 46

1 Answers1

9

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.

womble
  • 96,255
  • 29
  • 175
  • 230
  • Actually I believe `-O` to be the incorrect option... Would be `-o` instead – Jeremy Bouse Aug 25 '11 at 01: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 01:46