WP-Cron and GridPane’s GP-Cron

3 min read

Table of Contents

  1. Introduction
  2. Stack Update: Ubuntu 22.04 and GP-Cron Default
  3. Using GP-Cron
  4. Checking Your Cron Job on Ubuntu 20.04 and Earlier Stacks
  5. Checking Your Cron Job on Ubuntu 22.04 and Future Stacks
  6. How to List All Sites Running GP-Cron


WP-Cron is how WordPress handles scheduling time-based tasks such as checking for updates and publishing scheduled post.

At GridPane, we have GP-Cron, which does the same thing, but at the server level. Unlike WP-Cron, which relies on people visiting your website, you can set it to run at specific time intervals, ensuring that things like scheduled posts won’t miss being published.

Activating GP-Cron will disable the native WordPress cron via your websites wp-config.php file.

Stack Update: Ubuntu 22.04 and GP-Cron Default

On Ubuntu 22.04 and all future stacks, GP-Cron is now active by default on all of your sites.

This is automatically configured to run every 5 minutes out of the box, but you can follow the steps in this article to change the frequency if needed.

This also introduces some additional improvements/updates:

  1. GP-Cron now uses WP-CLI instead of wget to the wp-cron.php file.
  2. GP-Cron is now fully WordPress multisite compatible.
  3. Instead of the system user crontab, we’ve moved GP-Cron cron jobs to instead use cron.d. This opens the door to potentially adding a server/system user cron manager in the future.

Using GP-Cron

The following will setup gpcron to run on your website (it is not on by default). WP cron is disabled and set as a server cron job with this command:

gp site {site.url} -gpcron-on {minute.interval}

{site.url} is your site.

{minute.interval} is an integer value for minutes, it can be set from 1 to 60 minutes.

The cron will run as a system user cron for your site’s PHP user.

For example:

gp site gridpane.com -gpcron-on 15

The above sets GP-Cron to run every 15 minutes on gridpane.com

Disable GP-Cron

To disable GP-Cron you can run the following command (replace {site.url} with your website URL):

gp site {site.url} -gpcron-off

For example:

gp site gridpane.com -gpcron-off

Checking Your Cron Job on Ubuntu 20.04 and Earlier Stacks

These Cron jobs do not run under the root cron, as this would elevate WP PHP processes to root privilege and create a security risk, so you won’t find these in the regular crontab. You will need to check the website’s system user-specific crontab.

To do that you need to first move into your websites system user and display the crontab:

sudo su - {system.user}
crontab -l

{system.user} is the system user your site belongs to.

For example:

sudo su - steveswebs8348

You can also check running just one singular command as follows:

sudo su - {system.user} -c "crontab -l"

If you have run the command correctly, say for 1 minute, you should see the following in your users crontab:

*/1 * * * * wget -q -O - http://{your.site}/wp-cron.php?doing_wp_cron >/dev/null 2>&1

For more information on WP-Cron, you can check out the official documentation here:


Return to the root user

Once done checking your cron jobs you return to the root user with CTRL+D.

Checking Your Cron Job on Ubuntu 22.04 and Future Stacks

On Ubuntu 22.04, GP-Cron jobs are now located in /etc/cron.d. The GP-cron file naming convention replaces . with -. For example:

  • yourwebsite.com would be named yourwebsite-com.
  • staging.yourwebsite.com would be named staging-yourwebsite-com.

To view your cronjob, you can use the above naming convention in combination with this command:

cat /etc/cron.d/gp-cron-site-url

For example:

cat /etc/cron.d/gp-cron-yourwebsite-com

How to List All Sites Running GP-Cron

To view a list of all sites on a given server using GP-Cron you can run the command below to search each site’s env file for the value cron:true:

grep 'cron:true' /var/www/*/logs/*.env

Here’s an example of what the output will look like: