> For the complete documentation index, see [llms.txt](https://help.glpi-project.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.glpi-project.org/glpi-12/setup/crontasks.md).

# Automatic actions

GLPI has multiple automatic actions (also referred to as crontasks) that are periodically scheduled jobs. These actions can be configured to run at a specific frequency and run in either GLPI or CLI mode.

In GLPI mode, the actions are started occasionally when users navigate GLPI. In CLI mode, the actions are started in their own session via cron, Scheduled Tasks, or some other external task scheduler. You may configure some actions to run in GLPI mode and others to be CLI. Some actions may support only one of the modes.

***

## Configure CLI mode

To run CLI mode tasks, you will need to configure your external task scheduler to call GLPI `front/cron.php` file periodically. It is recommended to have it run every minute to ensure that actions that are ready to run, get ran as soon as possible.

For Linux/MacOS, you should add the following to the web server's user's (www-data, apache, etc) crontab:

```
* * * * * php GLPI/front/cron.php
```

You will need to replace `GLPI` with the path to your GLPI folder. You may also need to replace `php` with the full path to your php binary if it is not in the PATH.

***

## Force execution of action from CLI

To execute a specific action from the command-line, you can run (for mailgate action):

```
php GLPI/front/cron.php --force mailgate
```

You will need to replace `GLPI` with the path to your GLPI folder.

Forcing the action to run will ensure it is run even if it is not scheduled to run again yet.

***

## Force the execution of an action from the GUI

<figure><img src="https://content.gitbook.com/content/uys4bnfAs7Oe2yWUUh3p/blobs/hRLkBcTWz0iJKZW0LTGb/cron.png" alt=""><figcaption></figcaption></figure>

***

## The different tabs

<figure><img src="https://content.gitbook.com/content/uys4bnfAs7Oe2yWUUh3p/blobs/KSG7tSdedC3LJIhG8AQl/automatics_action.png" alt=""><figcaption></figcaption></figure>

### Automatic action

For each action, it is possible to configure:

* Run frequency
* Status: Allows you to disable the action if needed
* Run mode: **CLI** or **GLPI** (we recommend the CLI option, which is based on the instance's cron job. In GLPI mode, automatic actions are only triggered when the user is logged in)
* Run period: Allows you to disable certain actions at night for example
* Number of days this action's logs are stored: from 0 to 360 or infinite

The interface also allows you to reset the execution date and to manually force the execution manually.

Some automatic actions can have particular parameters, such as the maximum number of emails to be sent each time for the **`mailqueue`** action. Also plugins can define their own automatic actions.

***

### Statistics

<figure><img src="https://content.gitbook.com/content/uys4bnfAs7Oe2yWUUh3p/blobs/1Vx5UOHKuXGPeDQAx1rN/automatics_action_statistics.png" alt=""><figcaption></figcaption></figure>

Displays information about the execution of this task (number of executions, start date, minimum, maximum, average and total durations).

***

### Logs

<figure><img src="https://content.gitbook.com/content/uys4bnfAs7Oe2yWUUh3p/blobs/icryo8jFN3Sob8bNv8ZB/automatics_action_logs.png" alt=""><figcaption></figcaption></figure>

Lists the last executions according to the parameter defined in the *Automatic action* tab (see above). A link on the execution date allows to have the details of a specific execution.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.glpi-project.org/glpi-12/setup/crontasks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
