Skip to content

Cronjob

ConsentFriend can be controlled by a cronjob command.

Executing the cronjob command

The cronjob command can be executed from the command line with

php /path/to/your/modx/installation/assets/components/consentfriend/cron.php

or with an external webcronjob using the following url:

https://your.domain/assets/components/consentfriend/cron.php?cronjob_id=xxx

The value xxx has to be filled with the random string in the MODX system setting consentfriend.cronjob_id. The installation fills this system setting with a random string. Since ConsentFriend 1.10.0 the webcronjob does not run, if the system setting is empty. The command line call does not need the cronjob_id parameter.

The cronjob command outputs the result of the task as JSON.

The cronjob tasks

The cronjob command will run one task:

Update the GeoIP2 database

Normally the GeoIP2 database will be updated during manager access after the number of days in the system setting consentfriend.mmdb_refresh (30 days by default). A failed update is retried after one hour.

This can be done by the cronjob instead. In that case you have to set the system setting consentfriend.use_cron to true. Then the database is not updated during manager access anymore and the cronjob updates the database each time it runs. So the cronjob should not run more often than once a day.

If the database is missing, ConsentFriend tries to download it once in an hour. The errors of a failed download are logged in the MODX error log.