Rajalakshmi
Rajalakshmi

Reputation: 771

crontab expression to schedule a DAG to run in specific time interval

I have a requirement where my DAG has to run every 5 minutes from 5 AM to 6:30 AM. I know how to schedule with crontab it if it is from 5 AM to 6 AM like */5 5-6 * * * but I have to do this for time interval 5 AM to 6:30 AM. Any help is appreciated.

Upvotes: 0

Views: 621

Answers (2)

Rahul Agrawal
Rahul Agrawal

Reputation: 633

Since you want from 0 to 30 minutes, all you have to do is instead of every minute in the expression change it to 0-30 minutes with every 5 minutes step.

0-59/5 5-6 * * *

You can refer to https://crontab.guru/ for checking next values also. Since it gives only 5 next values, you can change the step up from 5 to 20 for better clarity.

Upvotes: 2

Ka Boom
Ka Boom

Reputation: 484

I think the only solution should be using two cron schedulers.

*/5 6 * * *
0-30/5 6 * * *

So you need to duplicate the dag with difference schedulers.

Upvotes: 1

Related Questions