# CRON

Chevereto requires to setup cron (opens new window) to run background jobs.

This cron setup reference applies mostly for Debian-based systems. We recommend checking your server documentation on how to setup and run cron.

Consider to contribute to this documentation with alternative cron setup alternatives.

# What it does?

A cron is system in which a command is executed in a regular basis, this way Chevereto can perform operations in the background.

# Troubleshoot

TIP

Refer to your system documentation and/or administrator for the best strategy when running Chevereto's cron requirements.

Having issues? Check the following common pitfalls:

  • Invalid format for cron schedule
  • The PHP binary may not be available in cron context, use the full PHP path binary
  • The location of the app/bin/legacy console may vary, use what reflects the file in your system
  • Wrong user running the command (requires a normal user with access to the project directory)
  • User www-data applies only for Debian-based system. Refer to your sysadmin for the appropriate user when using other OS

# Command

The command should be run by the web-server user which is www-data (may vary). To run the command in Chevereto it requires to call PHP binary at the Chevereto CLI.

Use which php to locate the PHP binary as its location.

Refer to CLI Cron.

# Docker command

docker exec -it \
    --user www-data \
    chevereto-container app/bin/legacy -C cron

# Cron.d file

Recommended setup is to create a cron.d file (opens new window). This is easy as:

cat >/etc/cron.d/chevereto <<EOM
* * * * * www-data php /var/www/html/app/bin/legacy -C cron
EOM

In the instruction above * * * * * (opens new window) is the cron schedule to run every minute.