Defer the Start of CRON Based Jobs - Alfresco Content Services - 23.4 - 23.4 - Ready - Alfresco - external

Alfresco Content Services

Platform
Alfresco
Product
Alfresco Content Services
Release
23.4
License

You can configure alfresco-global.properties and dev-log4j2.properties to implement a global delay to CRON based jobs; for example, until after the server has fully started.

You can set a delay for all cron based jobs; in other words, jobs that use the org.alfresco.util.CronTriggerBean class. The default value is 10 minutes.

  1. Shut down the Content Service server.
  2. Locate and edit the alfresco-global.properties file in the <classpathRoot> directory.
  3. Add two configurations to the alfresco-global.properties file, where the number in startDelayMins= is the number of minutes you want to delay your job. In this example, the delay length is 2 minutes:
     activities.feed.cleaner.cronExpression=0/1 * * * * ?
     activities.feed.cleaner.startDelayMins=2
    
  4. Extend the dev-log4j2.properties with a new configuration in the <classpathRoot>/alfresco/extension directory:
     logger.alfresco-repo-activities-feed-cleanup-FeedCleaner.name=org.alfresco.repo.activities.feed.cleanup.FeedCleaner
     logger.alfresco-repo-activities-feed-cleanup-FeedCleaner.level=trace
    

    This file will override subsystem settings that aren’t applicable in alfresco-global.properties.

  5. Start the server.

    After the specified interval, the FeedCleaner trace logs will be generated. In the example, the logs will start after two minutes.