Search code examples
cronscheduled-tasks

cron expression for every 30 minutes from 9am to 9pm and once at 3am midnight


Can you please guide me in writing a cron expression for every 30 minutes from 9am to 9pm and once at 3am midnight. Is it possible in one expression? I can do easily for every 30 mins 9am to 9pm as "*/30 9-21 * * *" but how to add 3am to this. Thanks.


Solution

  • Unluckily it is not possible to create it in a single cron. You will have to create 2 separate crons one which does the 30 minutes 9-21 like you have it and one to run it once at 3am.