Cron scheduler for jdbc plugin

Hi,

I am using jdbc plugin and schedule for fetching data from database. Currently cron is running fine for schedule => "* * * * *".
My requirement is cron ingestion should start at given time (10 pm) and end at given time (12pm) rather than stopping after ingestion is completed.
Need help in syntax and time format.

Regards,
Bryce Fernandes.

How often do you want it to run during the 10pm to 12pm timeframe?

Also here is a good tool that helps you with the syntax and gives a plain text explanation on what's going to happen.

Hi @aaron-nimocks

Thanks for the quick reply.
My use case is such i want to fetch the logs on per day basis. So it doesnt matter how many times it runs in the given time frame. If the data is missed out it would be fetched on the next day.
So basically i want it to run for the entire time frame so can run either every minute or every 5 minutes.
How would the syntax be for it ?

0 22,23,0 * * *

That will run at 10:00PM, 11:00PM, and 12:00PM every day. That sounds like it should be plenty for your use case.

1 Like

Thanks @aaron-nimocks
Just wanted to know when it starts at 10PM or 11PM or 12PM how long will it run and stop, will it run for a minute and stop?

It will run until the process is over and start again at the top of the next hour. The schedule looks like below.

10:00PM - Until all records are ingested. No idea how long that takes with your data.
11:00PM - Until all records are ingested.
12:00PM - Until all records are ingested.

So it would run 3 times a night which sounds like that is plenty for your use case.

Isnt there a way to stop after 12PM if the data ingestion is not complete but want to stop the cron.

How long does 1 normal ingestion cycle take?

I am not sure about the data yet have just been given a time frame.
Also i was testing a sample database with 15-20 20 * * * and that seems to work.

That cron will do "At every minute from 15 through 20 past hour 20."

So it will run at the below schedule. If your data takes more than 1 minute to ingest that might not work in the long run and could cause problems.

10:15 PM
10:16 PM
10:17 PM
10:18 PM
10:19 PM

Thanks @aaron-nimocks
I guess 3 cycles as you suggested will do the job. Just that had to show some range with stopping point to the management for approval of further testing.
I guess i can use this with a stopping point.
0 21-23 * * *

Thanks for your quick replies :smiley:

1 Like