Wordpress CRON job commands

Viewed 361

From browsing the web I've noticed two variations for the command to initiate the WordPress cron jobs from cPanel.

Please could someone explain the difference and which is the correct/best option to use?

  1. wget -qO- https://www.mydomain.co.uk/wp-cron.php &> /dev/null

  2. wget -q -O - https://www.mydomain.co.uk/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Thanks

2 Answers

Sure, I would love to explain the concept:

> is for redirect

/dev/null is a black hole where any data sent, will be discarded

2 is the file descriptor for Standard Error

> is for redirect

& is the symbol for file descriptor (without it, the following 1 would be considered a filename)

1 is the file descriptor for Standard Out

Therefore >/dev/null 2>&1 is redirect the output of your program to /dev/null. Include both the Standard Error and Standard Out.

cron will only email you if there is some output from you job. With everything redirected to null, there is no output and hence cron will not email you.

Hope I explained it more clearly.

you are using cron from Wordpress but some plugins disable or prevent CRON from working. My recommendation in this case is either you create this schedule through the Server Cron or you install a plugin to reaffirm your schedule.

I had the same problem it was even a little difficult to find ... And as you will see it doesn't have a current update, but for me it works. https://wordpress.org/plugins/wp-crontrol & https://br.wordpress.org/plugins/advanced-cron-manager/

Send news

Related