Maintain Akeneo PIM projects
#How to Purge jobs executions
This chapter gives details on how to purge jobs executions in order to decrease the database volume.
#The batch job command
Akeneo PIM provides a simple command to purge jobs executions:
bin/console akeneo:batch:purge-job-execution [-d|--days DAYS]
Don’t forget to add –env=prod to avoid memory leaks in dev environment (the default environment for commands)
You can also provide a custom configuration for the job:
bin/console akeneo:batch:purge-job-execution --days=30 --env=prod
For example, with the option –days=30, the command will remove all jobs executions and their archives when they were created over 30 days ago.
This purge command removes the job executions from the database and files from var/file_storage/archive directory.
#Scheduling the jobs
To run a command periodically, you can use a cron:
First, you need to install it (example in debian/ubuntu based distributions):
apt-get install cron
Then, you can edit your crontab:
crontab -e
You can now add a new line at the end of the opened file:
0 0 * * * /home/akeneo/pim/bin/console akeneo:batch:purge-job-execution --env=prod
With this cron configuration a purge of jobs executions older than 90 days, will be launched once a day.
Found a typo or a hole in the documentation and feel like contributing?
Join us on Github!