Cron job creating files each time it runs

Cron job creating files each time it runs



I have a cron job that runs the script every 30 minutes. The problem is each time it runs the cron it creates a file in the root directory. It'll create files like this:


wp-cron.php?doing_wp_cron.1
wp-cron.php?doing_wp_cron.2
wp-cron.php?doing_wp_cron.3



This is my cron:


*/30 * * * * wget http://yourdomain.com/wp-cron.php?doing_wp_cron 2>&1 > /dev/null



How can I make it auto delete after it finishes running the cron job or make it not create the file?




1 Answer
1



wget primarily is for downloading files, it might be better to use curl


curl



curl http://yourdomain.com/wp-cron.php?doing_wp_cron


curl http://yourdomain.com/wp-cron.php?doing_wp_cron



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy