Introduction
A Cron job is a term for a command that is run on a regular schedule, triggered by a system event or manually. There are different types of preconfigured cron jobs in hybris, namely:
- SOLR and Lucene related: indexing, updating, removing data,
- Cleaning up unnecessary data from the database or file system,
- Product catalog synchronization,
- Regular data export,
- Workflow,
- ImpEx import.
In hybris, cron jobs don’t have any inputs other than the cron job configuration and the current state of the system. When executed, cron jobs perform checks and take actions depending on the cron job’s purpose: updating or removing information in the database or file system.
For developers, manually triggering cron jobs during development is a common task. Hybris provides web tools for cron job management: Backoffice and HMC. These options are good for single use, but if you need to do it repeatedly, it is much easier to use the console utility.
Indexing is a cron job task, so if you change the logic of the indexer, which is a more or less common task for large projects, you will need to execute it many times during development or testing. For this particular task, the console tool is especially useful.
Usage
Show all configured cron jobs:
./hybrisCronjob.sh -aChange the status of a particular cron job:
./hybrisCronjob.sh -c <cronjobName> -s <true/false>Execute the cron job:
./hybrisCronjob.sh -e <cronjobName>
./hybrisCronJob.sh -e full-electronicsIndex-cronJobVideo
© Rauf Aliev, August 2016