Cron expression to run after 30 minutes past hour

Sirish picture Sirish · Aug 30, 2013 · Viewed 9.3k times · Source

I would like to schedule a job using Quartz to run 30 minutes past the hour. For example I want the job to run at 00:30, 1:30, 2:30 and so on.

Can you guys help me to get the correct cron expression?

Answer

Sotirios Delimanolis picture Sotirios Delimanolis · Aug 30, 2013

Simple enough

30 * * * *

Every 30th minute of every hour, every day of the month, every month, every day of the week. From wikipedia

# *    *    *    *    *  [command to execute]
# ┬    ┬    ┬    ┬    ┬
# │    │    │    │    │
# │    │    │    │    │
# │    │    │    │    └───── day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names)
# │    │    │    └────────── month (1 - 12)
# │    │    └─────────────── day of month (1 - 31)
# │    └──────────────────── hour (0 - 23)
# └───────────────────────── min (0 - 59)

For quartz, the cron expression introduces more fields (7 total), the first being seconds and the last being years (but optional). You can see those here.

You need

* 30 * * * * [*]