AdvanzoDocumentation

Cron Job

· Enterprise admins

In short

A self-hosted Advanzo CRM installation needs a cron job that runs the scheduler every minute; without it, background tasks do not run. This page has examples for cPanel, Plesk, SSH crontab, SiteGround, Hostinger and Bitnami.

Cron is a Linux utility that schedules a command or script on your server to run automatically at a specified time and date. A cron job is the scheduled task itself. Cron jobs are very useful for automating repetitive tasks.

Most modern applications need a configured cron job so that tasks can be executed in the background.

Advanzo CRM requires a properly configured cron job. Follow the steps below to configure the cron job for your installation.

For the examples below, make sure to replace /path/to/advanzo/ with the path to your installation.

On some shared hosting you may need to specify the full path to the PHP executable (for example, /usr/local/bin/php81 or /opt/alt/php81/usr/bin/php instead of php).

On the hosted version at advanzo.app this is already configured. This page applies to Enterprise installations on your own infrastructure.

Setting Up a Cron Job in cPanel

If you use cPanel, set up a cron job so that the scheduled tasks in Advanzo CRM run automatically:

  1. Log In to cPanel:
    • Access your hosting account's cPanel.
  2. Find Cron Job:
    • Use the cPanel search feature and type in "Cron Job" to locate the Cron Jobs section.
  3. Add New Cron Job:

    • In the Cron Jobs section, find the option to add a new cron job.
    • Enter the following command in the command field:

      php /path/to/advanzo/artisan schedule:run >> /dev/null 2>&1
    • Replace /path/to/advanzo with the actual path to your Advanzo CRM installation.

Setting Up a Cron Job in Plesk

  • Click Websites & Domains.
  • Click the domain/subdomain on which you installed Advanzo CRM.
  • Click Scheduled Tasks.
  • Click Add Task.
  • Choose Run a PHP script.
  • In the script path, enter your Advanzo CRM installation path and append artisan, for example: /path/to/advanzo/artisan.
  • In the with arguments field enter: schedule:run
  • Use PHP version: 8.1
  • Cron Style: * * * * *

Setting Up a Cron Job Via SSH

If you manage your server through SSH, configure the cron job from the command line. Set up the cron job under the user account that runs the web server processes, commonly the www-data user.

  1. Open Crontab for the Web Server User:
    sudo crontab -u www-data -e
  2. Add the Cron Job: In the crontab file, enter the following line:
    * * * * * php /path/to/advanzo/artisan schedule:run >> /dev/null 2>&1
  3. Replace /path/to/advanzo with the actual path to your Advanzo CRM installation.

Do not use the root user to configure the cron job. Set it up under the user account that runs the web server processes, so that it works properly.

Verifying Cron Job Configuration

Advanzo CRM only works reliably if the cron job is set up correctly. To check it:

  • Access System Info:
    • In your Advanzo CRM dashboard, go to Settings -> System -> System Info.
  • Check Last Cron Run:
    • Look for the Last Cron Run row.
  • Confirmation of Proper Setup:
    • If the Last Cron Run value is updated every minute, your cron job is configured correctly for your Advanzo CRM installation.

Common Cron Job Commands

Below are cron job commands that are confirmed to work with commonly used hosting providers. In most cases our customers confirmed them, so if your hosting provider is listed below, the command should work in your environment as well.

The examples below use the path /path/to/advanzo/ as an example. Make sure to replace it with the path to your installation.

Do you host Advanzo CRM with a commonly used hosting provider, and can you confirm that the cron job command works? Send us the command via our support area so that we can add it here and other customers can benefit from it.

SiteGround

Use the following command to configure the cron job on SiteGround servers.

/usr/local/php81/bin/php-cli /path/to/advanzo/artisan schedule:run >> /dev/null 2>&1

Hostinger

Hostinger does not allow any special characters in the cron job command, so you need to apply a simple workaround. Read more about how to set up a cron job with special characters at Hostinger.

The specific steps are simple:

  1. Create a cron.sh file in the root of your Advanzo CRM installation directory.

  2. Add the following contents to the cron.sh file:

    #!/bin/sh /opt/alt/php81/usr/bin/php /path/to/advanzo/artisan schedule:run >> /dev/null 2>&1
  3. In your Hostinger control panel, navigate to Advanced->Cron Jobs.

  4. Choose type custom.

  5. In the "command to run" field, enter: /bin/sh /path/to/advanzo/cron.sh

  6. Set the interval so the job runs every minute: set minute(s), hour(s), day(s), month(s) and weekDay(s) all to Every (*).

  1. Click save.

Bitnami

If you are using Bitnami, configure your cron job with the daemon user, as Bitnami suggests.

Run the following command to open the crontab file:

sudo crontab -e

Add the following command at the end of the file:

* * * * *  su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php /path/to/advanzo/artisan schedule:run >> /dev/null 2>&1"