Managing Site Cron Jobs

To ensure that your background WordPress tasks (scheduled posts, checking for plugin and theme updates, etc.) are actioned precisely when they should, SpinupWP configures a server-based scheduled task using the Linux cron service. This scheduled cron task uses WP-CLI to activate WP-Cron, which is the WordPress tool for checking for and processing scheduled tasks.

Usually, WP-Cron is only activated by visitors to your site, which is why SpinupWP uses the server cron to trigger any scheduled WP-Cron tasks. By default, a server cron is configured for each site and set to run at 5-minute intervals. A random offset is applied to each site so that all crons aren’t scheduled to run at the exact same time.

Cron-Related CPU Spikes

If you have a large number of sites on your server, or you have a large number of scheduled tasks across each site on your server, this could lead to the cron tasks causing CPU spikes. A CPU spike would happen when the cron tasks for sites on a server overlap, causing higher than usual CPU usage for a while. This high CPU usage could prevent your server from processing regular web requests, leading to delays and possibly timeouts for your website visitors. One way to avoid this problem is to decrease the cron frequency for any sites that don’t need to activate scheduled tasks on a strict schedule by configuring different cron intervals.

For example, if you have a site that must publish posts on a specific schedule every time, leave that at the default of 5 minutes, or change it to 1 minute for increased precision.

If you have sites that rarely have scheduled posts, you could increase the interval to every 60 minutes.

Editing a Site Cron Interval

To edit the cron interval for a site, visit the SpinupWP site dashboard and click on the Cron tab. Here you can easily enable/disable a site’s cron.

Screenshot of site cron settings

When cron is enabled, you can select the interval, the number of minutes between cron runs for the site.

If you continue to see cron related CPU spikes after fine-tuning the cron schedules on the server, you might want to consider moving some of the sites to a different server.

Customizing the Site Cron Command

You’re more than welcome to add additional site crons but you cannot customize a site’s WordPress cron command. We don’t recommend modifying the line under the #Ansible: <your_domain> comment in your site’s crontab as it will be overwritten by SpinupWP when the site’s cron settings are changed from the SpinupWP dashboard.