If one have two jobs “sync all” and “sync new” that one don’t want to be running at the same time how do one do that. My first taught was create only one job and use parameter to control if “new” or “all” was to be executed. But if we want them to run on different intervals visual studio doesn’t like us adding two policies with the same name in app settings.
Run one job let’s say every hour and base the logic on time.
Usually Sync all runs once per night time.
If server time is let’s say 00.00 then run the Sync all else run Sync new.
That is a solution but then we need to make codechanges to changes the intervalls and while where looking at this we started to wonder how or if this is handled for the litium jobs.
If we have multiple servers are all these jobs necessary to run on every machine at the same time or how does that work?
further if we would handle this with multiple web config and remove some of these jobs what are the default cronexpression for the litium jobs? We noticed that if we create a job and don’t want a job to run we can’t just exclude it from the config since it will use some default expression then
Looks like that page just confirms my questions. The appsettings override the CronScheduleJob cronschedule but at least with our own jobs it looks like if no cronscheduler set on the job it it self it looks like there are a default that the job defaults to since the job run even when not included in the appsettings.
So what is need to make the jobs not run at all is the question? Or are the litium jobs different so the won’t run if not included in appsettings?
The example om the page includes Litium.Auditing.CleanupScheduler is that a real example so Litium.Auditing.CleanupScheduler will be running on all machine at the same time? [CronScheduler("Litium.Auditing.CleanupScheduler", DefaultCronExpression = "0 0/1 * 1/1 * ? *", Parameter = "param1=text", **ExecutionRestriction = ScheduleCronJobExecutionRestriction.None**)]
You set this to none and they will run on all servers
ScheduleCronJobExecutionRestriction.None
“So what is needed to make the jobs not run at all is the question? Or are the litium jobs different so they won’t run if not included in appsettings?”
I understand what ScheduleCronJobExecutionRestriction.None will do. I’m asking if all the litium jobs are setup with ScheduleCronJobExecutionRestriction.None? if not, how they are configured and are there jobs that need or should to run on all servers?
I don’t want the platform jobs not to run at all i want to understand their behaviour. The example on the page includes example for Litium.Auditing.CleanupScheduler why would that one have ScheduleCronJobExecutionRestriction.None? is this just a bad example or should this job be running om all server?
And then we have the policys in the appsettings. Are you saying that the plattformjobs will not run at all if i remove the policys from appsettings? I ask because this is not the behavior if we create a custom job. In that case the scheduler looks to do a fallback to some default cornexpression.
that leads to the final question.
If we want to stop a custom job we created from running how do we do that since removing it from appsetting policys doesnt stop the job from running.
I will test again now i litium 8.7.1 but previously no cronexpression attribute in class resulted in that job is scheduled according to some default expression therefor removing it from appsettings did not stop the job from running.
We have tried to verify the bug that was created about this without luck.
You have detailed logging in the log file for the logger Litium.Application.Scheduler.CronSchedulerJobSetup that will describe the setup for each job that is registered or skipped.
Please double check these solutions and check the log:
Rebuild/Reset IIS after apply new configuration
Make sure appsettings.json file is configed correctly (maybe the configuration is overlapped by other appsettings files, eg: production, development, staging)