# Inactivate or pause execution of scheduled tasks?

**URL:** <https://forum.litium.com/t/inactivate-or-pause-execution-of-scheduled-tasks/1588>\
**Category:** Questions\
**Created:** [August 13, 2020, 9:47am UTC](https://forum.litium.com/t/inactivate-or-pause-execution-of-scheduled-tasks/1588 "2020-08-13T09:47:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hans](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/hans/32/31_2.png) [@hans](https://forum.litium.com/u/hans)\
**Post date:** [August 13, 2020, 9:47am UTC](https://forum.litium.com/t/inactivate-or-pause-execution-of-scheduled-tasks/1588/1 "2020-08-13T09:47:25Z")

</div>

Is it possible to programmatically temporarily pause the execution of registered scheduled tasks? We would like to be able to inactivate the execution without having to change the tasks configuration and restart the application.

([This is a similar question with a solution](https://forum.litium.com/t/scheduled-tasks-with-breaks/951), however it’s not feasible in our case.)

Litium version: 7.4

---

<div class="post-metadata">

**Author:** ![Ericsj11](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/ericsj11/32/899_2.png) [@Ericsj11](https://forum.litium.com/u/Ericsj11)\
**Post date:** [August 17, 2020, 6:28am UTC](https://forum.litium.com/t/inactivate-or-pause-execution-of-scheduled-tasks/1588/2 "2020-08-17T06:28:37Z")

</div>

A very simple solution could be a website setting with a IF statement in the task. (If you have more then 1 website you might need to get the specific website, or use a setting on another level)

```
public void ExecuteTask(SecurityToken token, string parameters)
{
    if(_websiteSettings.PauseTask1)
    {
       return;
    }
```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [September 14, 2020, 6:28am UTC](https://forum.litium.com/t/inactivate-or-pause-execution-of-scheduled-tasks/1588/3 "2020-09-14T06:28:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
