2

0 0 0 25 12 ?

this cron expression runs on every Christmas Day at midnight. I want to prevent it from running on Christmas Day.

Sonal
  • 262
  • 5
  • 22
  • 1
    The use case isnt quite clear for me. You have a job that is only running on a specific date and you dont want to run it on that specific date? Well then remove the task from the scheduler, delete the task, remove the cron entry etc. – BadK Dec 21 '15 at 11:23
  • @BadK I have to run this job on all days except on Christmas. what modification needed in this cron expression? – Sonal Dec 21 '15 at 11:59

1 Answers1

2

since you can define cron expressions only when they should run and not when they shouldn't run, i see only two options here:

  1. check the current Date within your task/job and if its Christmas Day, skip execution
  2. define a / multiple cron(s) that run on every other day than Christmas
    #runs every day starting january till november
    0 0 * * 1-11 *
    #runs every day in december except at the 25th
    0 0 * 1-24,26-31 12 *
BadK
  • 307
  • 3
  • 12