# \[APP\]\[Pro\] CronJob - Trigger Flows with Cron Expressions

**URL:** https://community.homey.app/t/app-pro-cronjob-trigger-flows-with-cron-expressions/103894
**Category:** Apps
**Created:** [February 13, 2024, 9:56am UTC](https://community.homey.app/t/app-pro-cronjob-trigger-flows-with-cron-expressions/103894 "2024-02-13T09:56:35Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![staeff](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/staeff/32/79712_2.png) [@staeff](https://community.homey.app/u/staeff)
#### Post date: [February 13, 2024, 9:56am UTC](https://community.homey.app/t/app-pro-cronjob-trigger-flows-with-cron-expressions/103894/1 "2024-02-13T09:56:35Z")

</div>

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/4/a4b03db219dd97430872954335d767880c1760ad.png)

A very simple cron scheduler. I didn’t want to have to create a separate device or handle some hidden away app settings just to run a flow on a certain schedule as some other apps do.

You can use any cron expression which is supported by [cron - npm (npmjs.com)](https://www.npmjs.com/package/cron).

You can use online tools like [Crontab.guru - The cron schedule expression generator](https://crontab.guru/) to help you generate your desired cron expression.

Some examples:

- `0 0,12 1 */2 *` → On the first day of every second month at midnight and noon
- `30 5-20/3 * * *` → 30 seconds after every third full hour between 05:00 and 20:00+
- `*/5 * * 6-9 1-5` → Every 5 minutes on weekdays (Mo-Fr) in summer months (June-September)

Stable Version: [CronJob App for Homey | Homey](https://homey.app/en-at/app/dev.schweiger.cron-job/CronJob/)  
Source Code: [github.com](https://github.com/stefan-schweiger/dev.schweiger.cron-job)

Any suggestions or additional translations are welcome. But I explicitly want to keep the App somewhat simple.

If you like what I have created you can buy me a beer through [Paypal](https://www.paypal.com/paypalme/StefanSchweiger).

---

<div class="post-metadata">

### Author: ![DirkH](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkh/32/78952_2.png) [@DirkH](https://community.homey.app/u/DirkH)
#### Post date: [February 13, 2024, 4:02pm UTC](https://community.homey.app/t/app-pro-cronjob-trigger-flows-with-cron-expressions/103894/2 "2024-02-13T16:02:45Z")

</div>

Great, I grew up (IT wise) with UNIX systems in the 1980s. Though it is some time ago, I fell like home. It is the natural way for recurring jobs for Linux based systems and still one of the most flexible systems.  
For example when you have many jobs that have to run once every hour, you can spread them over the hour, that you don’t have high cpu usage at the beginning of the hour.  
And for tasks like _every 20 minutes from 6am to 8pm, on Mondays, Tuesdays and Fridays, and only during summer months_ you don’t need complicated _And…_ cards.  
I will love it definitely.  
Many thanks 🙏 ❤🫂

---

<div class="post-metadata">

### Author: ![Anders\_Gregow](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/anders_gregow/32/61721_2.png) [@Anders\_Gregow](https://community.homey.app/u/Anders_Gregow)
#### Post date: [November 14, 2024, 6:55am UTC](https://community.homey.app/t/app-pro-cronjob-trigger-flows-with-cron-expressions/103894/3 "2024-11-14T06:55:20Z")

</div>

How do you stop the cronjob?  
Just delete the card?

---

<div class="post-metadata">

### Author: ![DirkH](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkh/32/78952_2.png) [@DirkH](https://community.homey.app/u/DirkH)
#### Post date: [November 14, 2024, 8:09am UTC](https://community.homey.app/t/app-pro-cronjob-trigger-flows-with-cron-expressions/103894/4 "2024-11-14T08:09:58Z")

</div>

> [@Anders\_Gregow](#):
>
> How do you stop the cronjob?

Hi @Anders_Gregow ,  
I do not really understand, what you want to do?

- The flow starts each time the condition is met and stops, when there there is nothing else to do.
- When you do not want the flows start after a defined hour/day/month, just put it in the condition.
- If you think you do not need the flow temporarily, you can de-activate the flow. And you can activate it again whenever you need it.
- If you want to do it by any external control (e.g. a variable), you can do it by checking the variable in an _And_ condition card.
- If you don’t need the flow any longer, you can delete the entire flow.
- Only in the case, you have many _When_ conditions (triggers) in an advanced flow and one of them is now obsolete, it is useful to delete the single card in the flow.  
So I hope your understanding of “_stop the cronjob_” is included in my answers.

---

<div class="post-metadata">

### Author: ![Anders\_Gregow](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/anders_gregow/32/61721_2.png) [@Anders\_Gregow](https://community.homey.app/u/Anders_Gregow)
#### Post date: [November 14, 2024, 8:59am UTC](https://community.homey.app/t/app-pro-cronjob-trigger-flows-with-cron-expressions/103894/5 "2024-11-14T08:59:29Z")

</div>

If I have a cronjob triggering every hour on wednesdays it will re-trigger automatically (of course).  
But when I do not want this to trigger any more (I want to remove the cronjob), do I then delete the flow triggered by the cron job?

e.g.  
“Schedule … triggered” → send push-notis to myself.

If I remove the “Schedule … triggered”, will the cronjob stop and be removed? If I understand your answers correctly, the answer is “YES”. 🙂

Why I ask is due to “normally” you start a timer with a “Start timer” card and then use a “Timer triggered” card.  
Not calling the “Start timer” will disable the timer, i.e. “removing” it.

---

<div class="post-metadata">

### Author: ![DirkH](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkh/32/78952_2.png) [@DirkH](https://community.homey.app/u/DirkH)
#### Post date: [November 14, 2024, 9:20am UTC](https://community.homey.app/t/app-pro-cronjob-trigger-flows-with-cron-expressions/103894/6 "2024-11-14T09:20:39Z")

</div>

> [@Anders\_Gregow](#):
>
> “Schedule … triggered” → send push-notis to myself.
> 
> If I remove the “Schedule … triggered”, will the cronjob stop and be removed? If I understand your answers correctly, the answer is “YES”. 🙂

In case, you are sure you won’t need the flow again in the near future (e.g. up to one year) just delete the flow. If you only delete the card, you keep an unusable flow.  
If you might want to use it again. just de-activate it. In case, you want to use it again (maybe after some amendments) you can activate it again.

 ![deactivate a flow](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/d/6d80c74747b29344054299335f859af4a36675f8.png)
