Member-only story
SAP Hybris cluster: Run Cronjobs only on backoffice nodes

Sometimes, in a hybris cluster setup, we have a requirement to run cronjobs only on ‘admin’ nodes or backend nodes and disable them on ‘application’ nodes or fronend/storefront nodes. This is how we can do this:
Assign all the cronjobs to a specific node group. Let us call the node group as ‘backoffice’.
INSERT_UPDATE CronJob;code[unique=true];job(code);nodeGroup
;myCustomCronJob;myCustomJob;backoffice
Add the below property to the local.properties file of the cluster nodes where you would like to run the CronJobs.
cluster.node.groups=backoffice
Now whenever your Cronjob is triggered, it will pick a hybris node that is a part of the group ‘backoffice’.
This will restrict the cronojobs to be executed only on the nodes of your choice. Normally, this setup is recommended in cluster environments where you don’t want to overload your storefront nodes by running Cronjobs on it. Storefront nodes should only be kept for handling the website traffic.
Deprecations
The task.excluded.cluster.ids property was the previous way to block task execution on specific nodes. It is still supported provided that you do not use new id autodiscovery. If you try to use both, id autodiscovery and task.excluded.cluster.ids, you will get a warning and the ids you want to exclude will not be taken into account — tasks will run on all nodes that have task.processing.enabled or task.engine.loadonstartup set to true.
If you set ‘task.engine.loadonstartup’ to false, it won’t run any of the cronjobs that were scheduled to run automatically through the triggers configured. But you can manually execute a cronjob from backoffice if needed.