# Cron job is not triggered

**URL:** <https://forum.litium.com/t/cron-job-is-not-triggered/2637>\
**Category:** Questions\
**Tags:** litium-8\
**Created:** [July 11, 2022, 2:29pm UTC](https://forum.litium.com/t/cron-job-is-not-triggered/2637 "2022-07-11T14:29:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![adam.clettborn](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/adam.clettborn/32/956_2.png) [@adam.clettborn](https://forum.litium.com/u/adam.clettborn)\
**Post date:** [July 11, 2022, 2:29pm UTC](https://forum.litium.com/t/cron-job-is-not-triggered/2637/1 "2022-07-11T14:29:54Z")

</div>

Hi,

I’m trying to add a cron job, but the job is never executed. I’ve tried different cron expressions without any luck.

Here’s my class:

```auto
[CronScheduler("Litium.Accelerator.SomeSyncJob", Parameter = "Some=parameter", ExecutionRestriction = ScheduleCronJobExecutionRestriction.None)]
public class SomeSyncJob : ICronScheduleJob
{
    public ValueTask ExecuteAsync(object parameter, CancellationToken cancellationToken = default)
    {
        // Execute the sync job
        return ValueTask.CompletedTask;
    }
}

```

appsettings.json:

```auto
"Litium": {
  "Scheduler": {
    "Policy": {
      "Litium.Auditing.CleanupScheduler": { "CronExpression": "0 45 0 1/1 * ? *" },
      "Litium.Customers.TargetGroups.CleanupScheduler": { "CronExpression": "0 13 0 ? * * *" },
      "Litium.Products.PriceAgentScheduler": { "CronExpression": "0 45 0 ? * * *" },
      "Litium.Sales.OrderMaintenanceScheduler": { "CronExpression": "0 40 0 ? * * *" },
      "Litium.Websites.SitemapScheduler": { "CronExpression": "0 25 0 ? * * *" },
      "Litium.Accelerator.PurchaseHistory": { "CronExpression": "0 30 3 ? * * *" },
      "Litium.Accelerator.SomeSyncJob": {
        "CronExpression": "0 17 16 1/1 * ? *"
      }
    }
  }

```

The problem here is that the job is never executed. I’ve tried to change the time in the cron expression to one hour before/after, and also added more delay with several minutes to the correct time. Am I missing something?

I’ve also tried with the property `DefaultCronExpression`, and also tried adding the `Parameter` property to appsettings.json, same story there.

Litium version: 8.3.1

---

<div class="post-metadata">

**Author:** ![steve.redstorm](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/steve.redstorm/32/14_2.png) [@steve.redstorm](https://forum.litium.com/u/steve.redstorm)\
**Post date:** [July 11, 2022, 2:59pm UTC](https://forum.litium.com/t/cron-job-is-not-triggered/2637/2 "2022-07-11T14:59:29Z")

</div>

Did you generate your changes by this [page](https://www.freeformatter.com/cron-expression-generator-quartz.html)?  
And try only with:

> [CronScheduler(“Litium.Accelerator.SomeSyncJob”)]

---

<div class="post-metadata">

**Author:** ![adam.clettborn](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/adam.clettborn/32/956_2.png) [@adam.clettborn](https://forum.litium.com/u/adam.clettborn)\
**Post date:** [July 12, 2022, 6:19am UTC](https://forum.litium.com/t/cron-job-is-not-triggered/2637/3 "2022-07-12T06:19:05Z")

</div>

I generated the expression using the link from the [docs](https://docs.litium.com/documentation/litium-platform/job-scheduler), which is [this one](http://www.cronmaker.com/).

I tried the attribute with just the policy name, but made no difference. I also tried to generate the expression from the site you provided, but the task is still not executed…

Edit:  
Alright, I tried with this expression: `0 21 * ? * * *`, to trigger the job at minute 21 each hour, and the job was executed. I guess there must be some kind of time zone difference between the clock in the accelerator and the clock on my PC?

---

<div class="post-metadata">

**Author:** ![adam.clettborn](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/adam.clettborn/32/956_2.png) [@adam.clettborn](https://forum.litium.com/u/adam.clettborn)\
**Post date:** [July 12, 2022, 7:15am UTC](https://forum.litium.com/t/cron-job-is-not-triggered/2637/4 "2022-07-12T07:15:48Z")

</div>

Confirmed. The expression `0 10 7 ? * * *` triggered the job successfully at 09:10, which means the hours are shifted two hours back for cron jobs. At least on my PC. Is this is a bug?

I created a [bug report](https://docs.litium.com/support/bugs/bug_details?id=61102) for this, as I’m not sure if this is the intended behaviour or not.

---

<div class="post-metadata">

**Author:** ![steve.redstorm](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/steve.redstorm/32/14_2.png) [@steve.redstorm](https://forum.litium.com/u/steve.redstorm)\
**Post date:** [July 12, 2022, 9:36am UTC](https://forum.litium.com/t/cron-job-is-not-triggered/2637/5 "2022-07-12T09:36:20Z")

</div>

Not sure if this is a bug but Product team will decide on that. I believe it must be based on UTC time however.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [August 9, 2022, 11:42am UTC](https://forum.litium.com/t/cron-job-is-not-triggered/2637/7 "2022-08-09T11:42:48Z")

</div>

Closed on August 9, 2022, 11:42am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
