Warning message

The service having id "facebook_widget" is missing, reactivate its module or save again the list of services.

cron

The trouble with WGET... is stopping those pesky output files

I think I must have been plagued for about 5 years with the age old issue of WGET requests creating unnecessary and unwanted empty files following a WGET request. WGET is tool for retrieving files via http, https and ftp via a command line interface.

I use WGET extensively for running cron jobs across the various blogs and websites running on my server. Each time the cron job is run, an empty file, i.e. cron.php is created. If a cron.php file already exists, it creates another cron.php 1, cron.php 2, cron.php 3 etc.

You can imagine after just a few days having hundreds of these breeding like wildfire.

Stupidly, rather than fixing the problem, I created a solution. To run another cron task which periodically deletes the cron files, 

rm /Users/jonathan/cron.*

This kind of works, but then I started using WGET for a whole heap of other tasks, and yes, the output files mounted up.

Half term holidays affords me the space to find these solutions, and it's a simple one.

When structuring a WGET request, simply add

--delete-after

to the request, i.e.

wget --delete-after http://www.southwoodfordnhw.info/cron.php

Works perfectly and as described. Relief at last.

Subscribe to RSS - cron