How to configure CRON node for duration based executions?

Hello!

I’m using n8n for last three months. By reading the n8n documentations I have created 10 workflows for our project. Which are working fine. CRON is used in all of them.

Is there anyway to configure a workflow to execute every 2 minutes in certain time duration and every 15 minutes rest of the duration?

For example: The workflow should get triggered every 2 minutes in between the times 7am to 5pm and every 15 minutes in between 5pm to 7am.

Because we don’t want to hit APIs in non working hours for every 2 minutes.

I used the below expression in custom mode

*/2 7-17 * * *

Welcome to the community @Siva_Nagarajan!

Yes looks good. A tool that is very helpful to create those expressions is:

Here with the expression, you posted above filled in:
https://crontab.guru/#/2_7-17_**

1 Like

@jan Thank you for your response.

If I use the expression, the workflow get executes every 2 minutes in between 7am to 5pm only. But I want to run the same workflow every 15 minutes rest of time that is 5pm to 7am.

Do I need to add one more expression for this in the same workflow? Will it work? Please check my settings.

image

Hey @Siva_Nagarajan!

Below is the configuration that you can use in your Cron node.

2 Likes

@harshil1712 Thank you very much!!!

It’s working as expected.

1 Like

I am glad it is working! Have fun!

1 Like