Dev Docs
  • Disciple.Tools Technical Documentation
  • Theme Core
    • API - Posts
      • List of Endpoints
      • Fields Format
      • Get Post
      • Create Post
      • Update Post
      • Post Comments
      • Post Activity
      • List Query
      • Global Search
      • Posts in Typeaheads
      • Post-Sharing
      • Get Following
      • Settings
    • API - Other
      • Users
      • Locations
      • Settings
    • Hooks
      • Record Page Hooks
      • API-Hooks
      • Public settings
      • Adding menu navigation links
    • Customization
      • Fields
      • Custom Post Types
      • Post Type Modules
      • Adding Fields and Tiles.
    • Authentication
      • JWT-Authentication-for-the-mobile-app
      • Site-to-Site-Link
      • Easy-Example
    • Permissions
    • Roles and Permissions
    • Database Tables
      • Activity Table
    • Disciple.Tools Translation
    • Revisions
      • v1.0.0-dev-changes
      • v1.0
  • Hosting
    • 404 Errors on new install
    • CRON
    • Hosting on WPEngine
    • Backups
    • Single Site or MultiSite
  • Disciple.Tools Development Setup
    • LocalWP
    • Mobile App Setup
    • Unit Tests
    • Cypress Tests
    • D.T on Docker Setup
    • Gulp - CSS and JS
  • Code Contribution
    • Theme Contribution Guidelines
    • How to Correctly Contribute to the Disciple Tools Repository
    • How to Translate Your Plugin
  • Style Guide
  • Disciple.Tools Code of Conduct
Powered by GitBook
On this page
  • Doing it manually:
  • Option 1 - Server Cron
  • Option 2 - Outsite Cron service
  • On Multisites
  • Option 1
  • Option 2

Was this helpful?

Edit on Git
  1. Hosting

CRON

Previous404 Errors on new installNextHosting on WPEngine

Last updated 8 months ago

Was this helpful?

Disciple.Tools relies on cron jobs for certain activities. Some of these are sending scheduled emails and creating update needed notifications.

WordPress’s default scheduling strategy depends on traffic. So then if no one comes to the site, the task may not run for a while. It will wait until the next visitor opens the site. A normal Disciple.Tools instance will not generate much traffic. This also slows down the server for this visitor as all these background tasks are now running.

For WPEngine.com: see this section in their documentatian They will do everything for you.

For other hosting services: we recommend googling the name of you hosting service along with "Replace WordPress Cron"

Doing it manually:

The solution is to disable the WP cron strategy. To do this, open the wp-config.php file and add the following line before the “/ That’s all, stop editing! Happy blogging. /” line:

define('DISABLE_WP_CRON', true);

Then,

Option 1 - Server Cron

you want to setup a cron on your server or with your hosting service to run every 5 mins:

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

Note: change yourdomain.com to you disciple.tools domain

Option 2 - Outsite Cron service

An alternative to setting up a cron job is to use a service like to ping http://yourdomain.com/wp-cron.php?doing_wp_cron every 5 minutes.

On Multisites

Option 1

Create a cron job for each subsite

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

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

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

Option 2

Create a script to call each subsite. Create a file custom-cron.sh in the same folder as your wp-config.php

custom-cron.sh contents:

/usr/local/bin/php /usr/local/bin/wp site list --field=domain --archived=0 --deleted=0 | xargs -i -n1 /usr/local/bin/php /usr/local/bin/wp cron event run --due-now --url="https://{}";

create the cron job, replace /path/to/wp/install with the path to you wordpress installating.

*/15 * * * * cd /path/to/wp/install && /path/to/wp/install/custom-cron.sh

On a large multisite you might want to make sure cron jobs don't run at the same time. For this we create a lock file while custom-cron.sh is running.

*/15 * * * * cd /path/to/wp/install && /usr/bin/flock -n /tmp/multisitecron.lock /path/to/wp/install/custom-cron.sh

https://wpengine.com/support/wp-cron-wordpress-scheduling/#WP_Engine_Alternate_Cron
Uptime Robot