How to stop Wget Cron jobs creating log files in home directory?
If you’re using /usr/bin/wget to run your Cronjobs you might notice that every time that cron runs – wget will also creates a log file and will places in your home directory. If you run cron too often (every few minutes) it can add up very quickly and pretty soon you’ll end up with thousands of useless (junk) log files in your home directory. Also your disk space could get consumed especially if you’re on shared hosting or have limited amounts of disk space available. We don’t want anything of that.
Solution is pretty simple actually. All you need to do is add an extra parameter -O /dev/null
So your wget command would look something like this:
/us/bin/wget -O /dev/null http://www.script.com/script.php
This will tell to save output to /dev/null – meaning not to save it at all..
It’s as simple as that. Let me know in comments if this worked out!
Why not buy me a coffee?