[SOLVED] cron job wget writing files to root directory

Problem

wget is a server side application use to run remote requests.

It’s commonly used in a ‘cron job’ – to schedule running a webpage – for example, triggering a WordPress wp-cron event.

By default the response from wget is written back to the server – resulting in many files in the server.

Solution

To stop wp-cron from writing files back to the server you need to use the command attributes to run in quiet mode and force output to go to a temporary directory.

This is done using -q – O /dev/null

For example, if your original command was

 wget https://www.wpdevguides.com/wp-cron.php

You would change it to

 wget -q -O /dev/null https://www.wpdevguides.com/wp-cron.php

Was this article helpful?

Related Articles