Edit Cron Expressions in the Scheduling.config File in Infor CRM SLX

In last week’s post, I discussed how to schedule jobs in the web client of Infor CRM SLX.  Today, I will be looking at using the scheduling.config file for  job management.  As I have mentioned before, Infor CRM SLX uses the scheduling.config file at C:\ProgramData\Sage\Scheduling\Tenants\SlxJobService to control how often various automated jobs run.  While it is possible (and often desirable) to block sections of the file to prevent some jobs from running altogether, it is also possible to edit the file to change the schedule for an individual job. The scheduling.config file uses Cron statements to regulate when the specified jobs run. While I am not a Cron expert, or even a Cron novice, really, I do know enough to edit an existing Cron expression to change how often a job runs. I will briefly explain how to do that in the limited context of the scheduling.config file.

Scheduling.config File

The Cron expressions in the scheduling.config file are easy to spot, because they are all contained in trigger id lines, and they specifically start with “cronExpression=”. To give some examples, the expression

cronExpression=”0/15 * * * * ? *”

tells that job to run every 15 seconds. While the expression

cronExpression=”0 0 0/1 * * ? *”

tells that job to run every hour. You will notice that each of the Cron expressions has 7 terms. The first three correspond to seconds, minutes, and hours. The last four have to do with with days or even years a job needs to run. As all the jobs with which we are concerned are running multiple times each day, the last four terms of every Cron expression in that file should be “* * ? *”, and we will only worry with the first three. (Note the fourth term in a Cron expression is days, so a 0/1 in the fourth column would run the job once per day. The remaining column can be used to specify which days a job will run, but are fairly complicated, and not at all intuitive.)

Generally speaking, for most purposes, you want the terms more precise than you are specifying to be 0 and the one less precise to be *.  Looking above, you will notice the Cron expression set for seconds has mainly asterisks after the seconds term, while the one specifying hours has two zero terms before the hours term. This is because a zero specifies not to use that time period, while an asterisk specifies to to run the job during ever occurrence of the corresponding time period (in every minute, in every hour, etc.). To put it as simply as I can, if you want a job to run every X seconds, you would use:

cronExpression=”0/X * * * * ? *”

If you want a job to run every Y minutes, use:

cronExpression=”0 0/Y * * * ? *”

If you want it to run every Z hours, use:

cronExpression=”0 0 0/Z * * ? *”

If you delve into Cron expressions, you can create very precise and/or complicated statements to makes jobs run precisely when you wish them to, but that is beyond the scope of what I can cover here. We are just looking at jobs we want to run at some regular interval.

Scheduling.config Jobs

As an example, let’s say your Infor CRM SLX in integrated with a Marketo system, and for some reason to need the sync job between CRM and Marketo to run much less often, only once an hour instead of every few minutes. Looking through the scheduling.config file, you do come across the section that schedules the Marketo job:

<job type=”SalesLogix.Integration.Marketo.Jobs.ScheduledMarketoJob, SalesLogix.Integration.Marketo”>
<triggers>
<trigger id=”Run every 5 minutes” cronExpression=”0 0/5 * * * ? *” />
</triggers>
</job>

If you look at that Cron expression, there is 0/5 in the second column.  The second term is minutes, so 0/5 there means to run that job every five minutes.  If we instead want the job to run every hour, we would change the second term to 0, and make the third (hours) term 0/1, telling the job to run every hour.  You would want to change the description as well, so the final result would be:

<trigger id=”Run every 1 hour” cronExpression=”0 0 0/1 * * ? *” />

Note that after making a change to that file, you will need to run the command IISRESET for the change to take effect. While it is more work to make changes this way than to simply adjust the schedule in the web client, there are reasons it will sometime be desirable to edit the scheduling.config file instead.     the changes made to the scheduling.config file are more durable.  When the server hosting the job server is rebooted, it forgets any changes previously made in the web  client Job Manager, and instead reads the scheduling.config file to determine the schedule. Even the schedule.config file itself is not fully permanent, as it overwritten when ever you redeploy the Infor CRM SLX job server.  If you have made changes to the scheduling.config file, you can preserve the during a deployment by not clicking Deploy All and instead only deploying the portals you need.  There is also a way to edit the jobs with Application Architect so the changes are deployed any time the job server is, which I will discuss next week.

(Cron is a widely used standard, and is not particular to Infor CRM SLX.  There are many places on the web that explain it in detail, and many site that will create Cron expressions using more intuitive interfaces.  I had the easiest time as a complete beginner using www.cronmaker.com , though there are many others that also work well.)

Want content like this delivered to your inbox? Sign up for our newsletter!

Submit a Comment

Your email address will not be published. Required fields are marked *