Cron Job

How to configure a Cron Job on WordPress

 

What is a Cron Job?

A Cron job is a task which is scheduled to run at a specific time automatically. For example, a Cron job can back up a file every six hours automatically.
Booknetic uses the standard WordPress Cron Jobs for sending reminder messages. The default WordPress Cron Jobs might cause delays for sending reminder messages. Because, by default, WordPress does not use a real Cron job. Instead, whenever a page is loaded on a WordPress site by any user, WordPress runs the Cron Job Tasks. If nobody visits your WordPress site, your tasks will not run. As a result, your messages will delay.

To resolve these issues, you should disable the default virtual WordPress Cron Job, and configure a real Cron job. To do this, follow the instruction below:

 

  1. Add the following line to the wp-config.php file:
    define('DISABLE_WP_CRON', true);
  2. Log in to Cpanel.
  3. Go to "Cron Jobs"
  4. Configure a real Cron Job on WordPress by copying your Cron task command from the Reminder section:

    Booknetic Cron Job

    And adding the command to the command section on your Cron job settings. If you want the messages to be sent at the exact time you defined, you need to set the Cron Job every 15 minutes.

Please consider that choosing a proper Cron Job interval can change according to your sync choice. 

1. Live sync; If you have a few staff, this method would be more convenient for you. When your customers are booking, the plugin will connect to the google calendar and sync busy slots in real-time. 

2. Background sync; For this method, first, you must configure the Cron jobs. The shorter you set the Cron jobs interval, the more accuracy you will get. This method is usually designed for businesses with a large number of employees and using the 'Any Staff' option. Because in this case, when your customer selects Any staff option, it might take more than 30-60 seconds to sync all Staff busy slots with Google calendar. By choosing this method, the plugin Cron Jobs will connect to the Google Calendars in the background at the interval you set up and will store the busy slots of all your employees in your local databases. During booking, it will read the information directly from your database. Errors in this method are inevitable. For example, if you configure your cron jobs to run every 15 minutes, the busy slot you add to your Google calendar will be stored in the plugin's local database every 15 minutes. That is, within these 15 minutes, someone con book on appointment in that time slot. Therefore, the shorter you configure the Cron jobs, the less likely there will be errors. 

  1. Booknetic Cron Job