January 04 2017

Cron with wget always created an empty file on server

Tagged Under :

I am trying to write a cron task to call wget on a url. The cron runs fine, but every time it runs it will creates a cron.php.X file in my home directory. I’ve tried to turn off output using the –quiet option but it’s still outputting a new file with every running.

To solve the output file when cronjob run with wget. you not only use –quiet option only. you need to add -0 option too.

5 * * * * wget --quiet -O /dev/null http://example.com/cron/cron.php

Make a Comment