# How to create cron job that is executing every 15 minutes?

**URL:** <https://discuss.hangfire.io/t/how-to-create-cron-job-that-is-executing-every-15-minutes/533>\
**Category:** feature\
**Created:** [January 10, 2015, 11:15am UTC](https://discuss.hangfire.io/t/how-to-create-cron-job-that-is-executing-every-15-minutes/533 "2015-01-10T11:15:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![NikolayIT](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/nikolayit/32/133_2.png) [@NikolayIT](https://discuss.hangfire.io/u/NikolayIT)\
**Post date:** [January 10, 2015, 11:15am UTC](https://discuss.hangfire.io/t/how-to-create-cron-job-that-is-executing-every-15-minutes/533/1 "2015-01-10T11:15:22Z")

</div>

Hi, I like this software very much! But one thing I am missing is how to add a recurring job that executes every few minutes (e.g. every 15 minutes). Is there a way to achieve this?

---

<div class="post-metadata">

**Author:** ![nirinchev](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/nirinchev/32/122_2.png) [@nirinchev](https://discuss.hangfire.io/u/nirinchev)\
**Post date:** [January 10, 2015, 4:16pm UTC](https://discuss.hangfire.io/t/how-to-create-cron-job-that-is-executing-every-15-minutes/533/2 "2015-01-10T16:16:44Z")

</div>

How about `RecurringJob.AddOrUpdate(() => /* your method */, "*/15 * * * *");`. The last argument is a normal Cron expression, so usual Cron rules apply: [http://en.wikipedia.org/wiki/Cron](http://en.wikipedia.org/wiki/Cron).

---

<div class="post-metadata">

**Author:** ![NikolayIT](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/nikolayit/32/133_2.png) [@NikolayIT](https://discuss.hangfire.io/u/NikolayIT)\
**Post date:** [January 13, 2015, 7:16am UTC](https://discuss.hangfire.io/t/how-to-create-cron-job-that-is-executing-every-15-minutes/533/3 "2015-01-13T07:16:48Z")

</div>

Thanks a lot. I’ve tried it and it is working now!

---

<div class="post-metadata">

**Author:** ![prasadk1](https://avatars.discourse-cdn.com/v4/letter/p/5f9b8f/32.png) [@prasadk1](https://discuss.hangfire.io/u/prasadk1)\
**Post date:** [January 16, 2015, 2:59pm UTC](https://discuss.hangfire.io/t/how-to-create-cron-job-that-is-executing-every-15-minutes/533/4 "2015-01-16T14:59:51Z")

</div>

Whats the difference between background task and recurring task? is it just the name? As in does a recurring job run in background itself? Because background task doesnt have a cron option. Please let me know your thoughts. Thanks

---

<div class="post-metadata">

**Author:** ![nirinchev](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/nirinchev/32/122_2.png) [@nirinchev](https://discuss.hangfire.io/u/nirinchev)\
**Post date:** [January 17, 2015, 8:31pm UTC](https://discuss.hangfire.io/t/how-to-create-cron-job-that-is-executing-every-15-minutes/533/5 "2015-01-17T20:31:44Z")

</div>

Recurring tasks execute more than once - that’s why they have a Cron field to control the execution pattern. And yes, they run in the background. Regular background jobs, on the other hand, execute once.
