Search code examples
javaspringquartz-schedulerspring-scheduled

Running a job during specific times of the day


I am writing a code to run a job during specific time frames of weekdays. I.e i need this job to run every 5 mins between 9 AM to 5 PM on weekdays. I could achieve this behavior by programmatically scheduling and disabling the job. Is there any out of the box option available to achieve similar behavior?


Solution

  • I could achieve this with help of below cron expression. Cron expressions rock !!

    0 0/2 9-16 ? * SUN,MON,TUE,WED,THU *