# Any Possible way to Turn ON and OFF workflow based on schedule time

**URL:** <https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423>\
**Category:** Questions\
**Created:** [September 23, 2020, 12:28pm UTC](https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423 "2020-09-23T12:28:51Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcnaveen](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mcnaveen/32/53924_2.png) [@mcnaveen](https://community.n8n.io/u/mcnaveen)\
**Post date:** [September 23, 2020, 12:28pm UTC](https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423/1 "2020-09-23T12:28:51Z")

</div>

Is there any possible way to automatically turn on and off the workflow based on the schedule timing on the scheduled day?

---

<div class="post-metadata">

**Author:** ![tanay](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/tanay/32/7225_2.png) [@tanay](https://community.n8n.io/u/tanay)\
**Post date:** [September 23, 2020, 12:33pm UTC](https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423/2 "2020-09-23T12:33:49Z")

</div>

Hi @mcnaveen, the Cron node can help you with that. You can find more information about the Cron node here: [Cron | Docs](https://docs.n8n.io/nodes/n8n-nodes-base.cron/)

---

<div class="post-metadata">

**Author:** ![mcnaveen](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mcnaveen/32/53924_2.png) [@mcnaveen](https://community.n8n.io/u/mcnaveen)\
**Post date:** [September 23, 2020, 3:58pm UTC](https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423/3 "2020-09-23T15:58:05Z")

</div>

> [@tanay](#):
>
> Cron node can help you with that

Unfortunately, cron job won’t turn on workflow, right?

Here is my use case.

I have a Cron job that does something every 5 Minutes.  
But if i’m offline how can I auto turn on and off the workflow using Cron on specific day at specific time?

I want to control **turn on and off the workflow**.

 ![Selection_262](https://europe1.discourse-cdn.com/n8n/original/2X/c/c56af2bd26bb59de559a27ca52fc34541029f712.png)

---

<div class="post-metadata">

**Author:** ![tanay](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/tanay/32/7225_2.png) [@tanay](https://community.n8n.io/u/tanay)\
**Post date:** [September 23, 2020, 4:53pm UTC](https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423/4 "2020-09-23T16:53:05Z")

</div>

Hi @mcnaveen, not sure what exactly you mean by _turn on_ the workflow. With your current settings, the Cron node will trigger your workflow every five minutes (provided that it’s correctly connected).

Not sure what you mean by _offline_. The workflow will get triggered according to the settings of the Cron node as long as n8n itself is running. It doesn’t matter if the Editor UI is open on a browser window as long as the n8n process (for example, the docker container) is running. Hope that helps!

---

<div class="post-metadata">

**Author:** ![mcnaveen](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mcnaveen/32/53924_2.png) [@mcnaveen](https://community.n8n.io/u/mcnaveen)\
**Post date:** [September 24, 2020, 10:24am UTC](https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423/5 "2020-09-24T10:24:18Z")

</div>

Let’s say, I have a workflow that sends updates every 5 Minutes using cron node.

But I have to make the Workflow Active for that, with the Button in top right corner. If the workflow is inactive, It won’t send right.

Suppose, If I’m offline (Away from the Internet). **Can I make the Workflow ACTIVE** at the scheduled time using a cron node?

Or make the workflow inactive at scheduled time.

Hope you’re getting my point

---

<div class="post-metadata">

**Author:** ![tanay](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/tanay/32/7225_2.png) [@tanay](https://community.n8n.io/u/tanay)\
**Post date:** [September 24, 2020, 10:53am UTC](https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423/6 "2020-09-24T10:53:29Z")

</div>

Hi @mcnaveen, that’s correct. The workflow will have to be set as Active for the Cron node to work. If you set a workflow as active, it will only run during the time specified in the Cron node (which could be either every five minutes or during the specified time).

Consider the example below, where I have set the Cron node to run the workflow at 12.45 everday. Even though the workflow is set to active, if we look at the executions, it executes only at the time set by the Cron node. You can add multiple conditions in the Cron node such as every minute or every X additionally.

![Demo-Cron](https://europe1.discourse-cdn.com/n8n/original/2X/9/927234423485134cfb66161584817a1a0b476710.gif)

So you’ll only have to set the Cron node correctly and set the workflow to active. If the workflow is not set to active, the only way to execute it, is manually.

---

<div class="post-metadata">

**Author:** ![tanay](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/tanay/32/7225_2.png) [@tanay](https://community.n8n.io/u/tanay)\
**Post date:** [September 24, 2020, 11:00am UTC](https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423/7 "2020-09-24T11:00:54Z")

</div>

Another example could be where you probably want to execute the workflow every five minutes between 8-18 (the workflow would do nothing outside of this timeframe). In such cases, you can use the ‘Custom’ option from the _ **Mode** _ dropdown list and set the following for the _ **Cron Expression** _ field: `0 */5 8-18 * * *`.

I use this website to generate custom Cron expressions: [Free Online Cron Expression Generator and Describer - FreeFormatter.com](https://www.freeformatter.com/cron-expression-generator-quartz.html)

Hope this helps! 🙂

---

<div class="post-metadata">

**Author:** ![mcnaveen](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mcnaveen/32/53924_2.png) [@mcnaveen](https://community.n8n.io/u/mcnaveen)\
**Post date:** [September 24, 2020, 11:04am UTC](https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423/8 "2020-09-24T11:04:46Z")

</div>

Thanks for your reply @tanay

So the workflow active and deactivate can’t be scheduled now. Am I right?

How about execute workflow has an option to make the workflow active. Or inactive. It’d be awesome.

---

<div class="post-metadata">

**Author:** ![pdovhomilja](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/pdovhomilja/32/15582_2.png) [@pdovhomilja](https://community.n8n.io/u/pdovhomilja)\
**Post date:** [August 26, 2022, 8:39am UTC](https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423/9 "2022-08-26T08:39:45Z")

</div>

Hi, I’m new one in N8N. First of all I must to say that it is great thing. I want to ask if it is possible to run cron in specific time. I need tu run my workflow from 18:00 to 7:00. I know hot to run script with cron job at 18:00 but I didnt find hot to stop the worklfow if it is not complete at 7:00. I fetch some data from API where is limit restriction in some business hours. Thank you.

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [August 26, 2022, 8:42am UTC](https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423/10 "2022-08-26T08:42:55Z")

</div>

Hi @pdovhomilja, welcome to the community!

I think a value in the Cron node like `0 0-7,18-23 * * *` should do, like so:

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/f/7/f7af20c984dac4d6977c2665f6c80ea047eaad14.png)

You might also want check out [this page](https://crontab.guru/#0_0-7,18-23_*_*_*) which can help you with building more complex cron expressions and previewing the next execution times.

Let me know if you have any questions on this!

---

<div class="post-metadata">

**Author:** ![pdovhomilja](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/pdovhomilja/32/15582_2.png) [@pdovhomilja](https://community.n8n.io/u/pdovhomilja)\
**Post date:** [August 26, 2022, 9:22am UTC](https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423/11 "2022-08-26T09:22:58Z")

</div>

Hi @MutedJam, thanks for quick respons. Worflow will be finish even the tasks are not all done? It it is true then it is exactly what i find. Thank you.

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [August 26, 2022, 9:25am UTC](https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423/12 "2022-08-26T09:25:06Z")

</div>

Hi @pdovhomilja, the workflow will start even if a previous execution is still running.

Or in other words, having a cron node like above means your workflow will start at 00:00 and then run until it finishes. A new execution will start at 01:00 and keep running until it’s done, even if the previous execution hasn’t finished yet.

---

<div class="post-metadata">

**Author:** ![pdovhomilja](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/pdovhomilja/32/15582_2.png) [@pdovhomilja](https://community.n8n.io/u/pdovhomilja)\
**Post date:** [August 26, 2022, 9:28am UTC](https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423/13 "2022-08-26T09:28:58Z")

</div>

But it is that problem, because i need to fetch over 1milion tasks and there is API limit for 50000 per day. My worflow has checsum db and when it finis, then start another 50000. But now I must run this workflow manualy.

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [August 26, 2022, 9:31am UTC](https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423/14 "2022-08-26T09:31:49Z")

</div>

Hi @pdovhomilja I am not sure I understand the problem I am afraid. With a daily API limit perhaps you could consider simply running your workflow once per day?

---

<div class="post-metadata">

**Author:** ![pdovhomilja](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/pdovhomilja/32/15582_2.png) [@pdovhomilja](https://community.n8n.io/u/pdovhomilja)\
**Post date:** [August 26, 2022, 9:46am UTC](https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423/15 "2022-08-26T09:46:08Z")

</div>

The limit is set up because i can stop it automatically. When it is possible to run only in specific time (18-7) i do not use the limit on mongoFind node. But I must know that workflow will not go in other time slot and dont do more then 50k requests.

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [August 26, 2022, 9:52am UTC](https://community.n8n.io/t/any-possible-way-to-turn-on-and-off-workflow-based-on-schedule-time/2423/16 "2022-08-26T09:52:12Z")

</div>

So if you want to make sure your workflow stops at a given time you could configure a timeout for your workflows. Head to your workflow settings like so:

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/9/0/9055cb18a304c70b5a23cdeffc9f57bbfd6f7b8c.png)

…and then configure a timeout of - for example - 59 minutes like so:

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/8/7/87e827e61649247baaf572667d96338987202d95.png)
