Search code examples
linuxcronquartz-schedulercron-taskcronexpression

Cron Expression for running a job at different intervals at different hours


I want to schedule a job to run every 5 mins during morning (4-8)AM and evening (7-11)PM and rest of the day every 30 minutes, how can i write a cron expression for it?

I can do this by using two cron expressions for scheduling, but can i do the task using one expression?


Solution

  • No, I believe you'll need 2 separate CRON expressions.