Use cron for automated tasks

glpiGLPI automated tasks can be triggered by visitors using the web interface (GLPI), or by a cron task (CLI). Cron is the recommended method, and this article describes how to set it up.


Simultaneous tasks

In a default install of GLPI there are 36 automated tasks that are individually configured to run at different times. When running your cron job, you can configure the maximum number of tasks to be run each time.

  1. Log on to GLPI.
  2. Go to Setup > General.
  3. Select the System tab, in the left pane.
  4. Set the Maximal number of automatic actions (run by CLI).

The default number is 5 actions, which if you set the cron job to run frequently enough should be fine.

 

Cron Job

How you create a cron job will depend on your hosting situation. This article describes how to achieve this using Siteground hosting, but the steps might be similar for other situations.

  1. Log on to your web host provider.
  2. Go to the Cron Jobs configuration page.
    1. Command: php /path_to_your_root_directory/front/cron.php
    2. Interval: Select manually
    3. Minute Hour Day Month Weekday: */1 * * * *

This will trigger the cron job every minute, which is useful in test mode, so you can easily see if it's working. Depending on the urgency of receiving tickets for example, you might configure this to run every 10 or 15 minutes?

 

Automatic actions

By default many automatic actions are triggered by the GLPI method, so you can change some of these to CLI.

  1. Go to Setup > Automatic actions.
  2. Click the record to open it for editing (e.g. mailgate).
  3. Select the Automatic action tab in the left pane.
  4. Change Run mode from GLPI to CLI.
  5. Click Save

This Automatic actions will now be triggered by the cron job. Here is a list of Automatic actions that I like to be triggered by CLI.

  • mailgate
  • mailgateerror
  • graph
  • olaticket
  • planningrecall
  • queuednotification
  • slaticket

 

Thanks for visiting,
Steven