virtualMachinepimcore

Configure scheduled tasks

NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:

 $ test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.

Approach A: Bitnami installations using system packages

Pimcore’s scheduler is enabled by default. To check if the cronjob is enabled, run the command below:

$ cat /etc/cron.d/pimcore

You should see the following output:

*/1 * * * * daemon /opt/bitnami/php/bin/php /opt/bitnami/pimcore/bin/console maintenance --env=prod >> /dev/null 2>&1

IMPORTANT: It is strongly recommended to run the task every 5 minutes, or at least every 10 minutes. By default, it is configured to run every minute, since Pimcore recognizes if there is an active job and executes only those jobs which are not active.

In case it is commented or disabled, add the line below to the /etc/cron.d/pimcore file and save:

*/1 * * * * daemon /opt/bitnami/php/bin/php /opt/bitnami/pimcore/bin/console maintenance --env=prod >> /dev/null 2>&1

Approach B: Self-contained Bitnami installations

To use Pimcore’s scheduler, it is necessary to set up a scheduled task/cronjob. Confirm that it is working by running the following command:

$ sudo crontab -u bitnami -l

You should see the following output:

*/5 * * * * sudo su daemon -s /bin/bash -- /opt/bitnami/php/bin/php /opt/bitnami/apps/pimcore/htdocs/bin/console -vvv maintenance

IMPORTANT: It is strongly recommended to run the task every 5 minutes, or at least every 10 minutes. If you prefer, you can also run the task every minute, since Pimcore recognizes if there is an active job and executes only those jobs which are not active.

In case it is disabled, run Pimcore scheduler following the steps below::

  • Run the following command to edit the crontab file:

      $ sudo crontab -u bitnami -e
    
  • Add the following lines to the file. The jobs will be executed the first minute of every hour. You can modify the timing if you wish:

      */5 * * * * sudo su daemon -s /bin/bash -- /opt/bitnami/php/bin/php /opt/bitnami/apps/pimcore/htdocs/bin/console -vvv maintenance
    
  • Save the file and exit.

Last modification March 3, 2021