WPCloudDeploy Documentation

Native Linux Cron

WordPress has a scheduler that allows processes to run on a periodic basis.  However this scheduler has two fatal flaws:

  1. It only runs when there is activity on the site. This means that if a process is scheduled to run at 1:00 pm but no activity has occurred around that time-frame, the process will not run until someone uses the site.
  2. Because it runs every time there is activity on the site, it uses up resources on every request for a page/post/object.  For sites with a lot of simultaneous users or heavy activity, it’s a lot of unnecessary overhead.

However, there is a way to make sure that WordPress runs scheduled tasks without missing them and without unnecessary overhead.  It involves setting up a native Linux Cron (“cron” is the Linux scheduler.)

To enable this:

  • Go to WPCloudDeploy → All Apps (or WPCloudDeploy → WordPress Sites)
  • Click on the site for which you need an SSL certificate
  • Click on the Crons tab
  • Select an interval – this is how often the native Linux cron will force WordPress to check to see if scheduled tasks need to be run.  The lower the interval the more load on the site.  But, some sites do need a 1 minute interval so it’s available as an option – if yours do, then choose that.  Otherwise choose 15 mins or 60 mins.
  • Click on the toggle switch and then click the OK button on the confirmation message

Notes

  • Some plugins try to be helpful and will throw a warning in the wp-admin area that CRON is disabled (because a constant is added in wp-config.php to disable the WP CRON.)  These messages can be safely ignored if the LINUX Cron is configured.
  • When you activate CRONs on a multisite installation of WordPress, the cron process will loop through and trigger on each sub-site.  If you set your interval to 1 minute then you’ll be doing this every minute, causing a ton of load on your installation.  Think very carefully about activating a native Cron on a Multisite installation of WordPress.  And, if you do decide that it is appropriate, whether you can use a larger interval such as 15 or 60 minutes.  The more sub-sites you have, the more critical this decision will be for performance.

Using the WP CRONTROL Plugin To Monitor WP Cron Jobs

The WP CRONTROL plugin is a great tool that allows you to view WP cron jobs.

Once installed, go to the TOOLS → CRON EVENTS screen.

In there you should see a full list of WP Cron jobs and the next time that each will run.  If you see a lot of them with the NEXT RUN set to ‘due now’, it likely means the Linux Cron isn’t working properly.


Learn More

You can learn more about how WP handles CRON JOBS in our ALL ABOUT WP CRONS help article.


 

Share: