Setup Cron jobs

  • there are 3 other Cron Jobs that can be setup to improve user experience:
    • CRON Jobs for Campaign Data
    • GEO-Stats CRON Job
    • CRON Job for Automatic Mobile Detection Updates

IMPORTANT: These Cron Jobs are Optional and recommended for high traffic users who DO NOT have caching enabled.

CRON Jobs for Campaign Data

NOTE: If you have TrueCache Enabled DO NOT run the Campaign Data CRON Job, as this process is already built in to Caching Process.

  • This Cron Job gives you the option to move some operations from the Campaigns page in an offline process that can be run periodically as a Cron job. These operations calculate data on the Campaigns Page.
  • The main advantage is that the amount of time required for the calculations isn't wasted on the campaigns.php page, it is moved in a separate process, so users won't have long intervals when logging into the application.

Activation

  • In order to activate the Cron job in CPV Lab Pro and stop performing those calculations inside the page, you have to check the option ‘Use Cron Job for data on campaigns.php’ from the Settings page.

Cron Job Activation

Installation

  • The CRON job consists of a PHP page (cron-campaigns.php) that will be called periodically and will perform the calculations.

  • The job can be configured in cPanel by following the next steps:

    • Step 1. Login into cPanel and find the ‘Cron jobs’ page

    Cron Job cPanel

    • Step 2. Enter the Cron job details in this page.

      • The recommended interval for the job to run is ‘Every 15 minutes’, meaning you have to enter ‘*/15’ for Minute and ‘*’ for Hour, Day, Month, Weekday (these options can also be selected from the dropdown controls on the right).
      • Then enter the command:

      cd /home/<server-name>/public_html/cpvlabpro/; php cron-campaigns.php

      • Or by an alternate command if the command above doesn’t function properly on your server.

      php /home/<server-name>/public_html/cpvlabpro/ cron-campaigns.php

    Add Cron Job

    • Step 3. Click the ‘Add New Cron Job’ button and the new Cron job will appear in the jobs list.

    Cron job list

GEO-Stats CRON Job

  • This feature allows you to move the process of capturing GEO data to a Cron job, to move the process outside of the Campaign URL and won’t slow the redirects, recommended for high traffic figures and large databases.
  • In order to enable the Cron job for Geo Details you have to follow these steps:

1. Set the Geo Cron Job Settings from Configuration Editor Page to “ON”

UseGeoCon constant

2. Setup the Cron job on the server

  • Based on the server settings the command should be one of the following:

cd /home/<server-name>/public_html/cpvlabpro/; php cron-cache.php

OR

php /home/<server-name>/public_html/cpvlabpro/cron-cache.php

Make sure either of the commands you use from above, include the full path to the location of the “cron-cache.php” file on your server. This will vary based on your server configuration. Also replace <server-name> with the correct Server Name based on your server configuration.

3. The Cron job should be setup to run every 10-15 minutes.

  • This interval is the delay that the Geo Details will appear in CPV Lab Pro for visitors. Cron Job setup

Note: The Cron job uses the same page (cron-cache.php) as the Cache Cron job, so if you already have the Cache Cron job setup you don’t need to re-enter a new Cron job. All you have to do is setup the “Geo Cron Job” key in the Configuration Editor Page to ON.

CRON Job for Automatic Mobile Detection Updates

  • This CRON job consists of a PHP page (cron-wurfl.php) that will be called periodically to update the detection databases with new carriers, mobile devices and browsers.

  • The job can be configured in cPanel by following the next steps:

    • Step 1. Login into cPanel and find the ‘Cron jobs’ page

    Cron Job cPanel

    • Step 2. Setup a Cron Job, that will run once every day.
      • You have to provide the complete server path to the cron-wurfl.php page from the root of CPV Lab Pro.
      • Then enter as command:

    cd /home/<server-name>/public_html/cpvlab/; php cron-wurfl.php - Or by an alternate command if the command above doesn’t function properly on your server.

    php /home/<server-name>/public_html/cpvlab/cron-wurfl.php

Make sure either of the commands you use from above, include the full path to the location of the “cron-wurfl.php” file on your server. This will vary based on your server configuration. Also replace with the correct Server Name based on your server configuration.

  • Example: In the image below you can see the Cron job being scheduled to run every day at 6:40 AM.

Setup Cron job wurfl

  • Click the ‘Add New Cron Job’ button and the new Cron job will appear in the jobs list.

Checking if CRON Jobs are Setup Correctly

  • Each time the Cron job runs, it will write 2 records in the Error Log: One for marking the start of the process and One for the end of the process.

Cron Job Check

You may also find useful: