Our blog

 

Cron Creating Lots of Files in Home Directory

If you have some cron jobs set up and you are finding large amounts of files saved in your home directory (or root) then perhaps you have the same issue I had.

I was using wget to call on some PHP scripts to run periodically. wget will do what it says on the tin and save the files. If you don't want it to do that, you need to add the following in front of your wget command:

CODE:
  1. -O /dev/null

eg

CODE:
  1. wget -O /dev/null http://script.com/script.php

More Reading:

2 Comments

admin
September 22nd, 2009

to clean up those files created by wget, try this command:

CODE:
  1. ls | grep -E "\.php\.[0-9]" | xargs rm

 

Ryan
March 23rd, 2010

I actually was using a -O /dev/null in my cron but I discovered I had over 12000 0 byte files in a folder just outside my public_html folder. I didn't really want to just make another cron to fix it so to avoid this problem I used this cron instead:

/usr/bin/php -c /path/to/php.ini /path/to/cron.php

 

 

Leave a Reply