Warning message

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

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.

Add new comment

Filtered HTML

  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Image CAPTCHA
Enter the characters shown in the image.
Refresh Type the characters you see in this picture. Type the characters you see in the picture; if you can't read them, submit the form and a new image will be generated. Not case sensitive.  Switch to audio verification.