# Scheduling a chef-client run

**URL:** <https://discourse.chef.io/t/scheduling-a-chef-client-run/12315>\
**Category:** Chef Infra (archive)\
**Created:** [December 15, 2017, 2:18pm UTC](https://discourse.chef.io/t/scheduling-a-chef-client-run/12315 "2017-12-15T14:18:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![priyanshu](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@priyanshu](https://discourse.chef.io/u/priyanshu)\
**Post date:** [December 15, 2017, 2:18pm UTC](https://discourse.chef.io/t/scheduling-a-chef-client-run/12315/1 "2017-12-15T14:18:50Z")

</div>

Is there a way to run chef-client based on some schedule of a time ?

Will push job be able to do scheduling ?

---

<div class="post-metadata">

**Author:** ![joerg.herzinger](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/joerg.herzinger/32/1514_2.png) [@joerg.herzinger](https://discourse.chef.io/u/joerg.herzinger)\
**Post date:** [December 15, 2017, 2:27pm UTC](https://discourse.chef.io/t/scheduling-a-chef-client-run/12315/2 "2017-12-15T14:27:17Z")

</div>

Yes, and there are several ways to do this. Check out the chef-client cookbook ([https://supermarket.chef.io/cookbooks/chef-client](https://supermarket.chef.io/cookbooks/chef-client)). I can do all of this for you.

---

<div class="post-metadata">

**Author:** ![priyanshu](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@priyanshu](https://discourse.chef.io/u/priyanshu)\
**Post date:** [December 15, 2017, 3:01pm UTC](https://discourse.chef.io/t/scheduling-a-chef-client-run/12315/3 "2017-12-15T15:01:53Z")

</div>

Suppose we need to perform patching based on some time given as Input by customer…so how can we store that time and based on that time the chef-client gets invoked?

---

<div class="post-metadata">

**Author:** ![priyanshu](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@priyanshu](https://discourse.chef.io/u/priyanshu)\
**Post date:** [December 15, 2017, 3:10pm UTC](https://discourse.chef.io/t/scheduling-a-chef-client-run/12315/4 "2017-12-15T15:10:30Z")

</div>

Though it has the attributes but how and where to pass and set these values in a recipe to run as a cron jobs

---

<div class="post-metadata">

**Author:** ![priyanshu](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@priyanshu](https://discourse.chef.io/u/priyanshu)\
**Post date:** [December 15, 2017, 3:20pm UTC](https://discourse.chef.io/t/scheduling-a-chef-client-run/12315/5 "2017-12-15T15:20:00Z")

</div>

How can i integrate this chef-client cookbook with my own cookbooks o patching so that the value we pass as a time is read and action is done accordingly.

---

<div class="post-metadata">

**Author:** ![priyanshu](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@priyanshu](https://discourse.chef.io/u/priyanshu)\
**Post date:** [December 15, 2017, 3:26pm UTC](https://discourse.chef.io/t/scheduling-a-chef-client-run/12315/6 "2017-12-15T15:26:32Z")

</div>

I am using a data bag item to take the value from frontend and these values from databag item is being used in a recipe.  
Now the data bag item has the value of time at which the chef-client should be invoked , that too should be done remotely means chef-client will be fired from workstation and not directly on node…through knife ssh command

---

<div class="post-metadata">

**Author:** ![joerod](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@joerod](https://discourse.chef.io/u/joerod)\
**Post date:** [January 2, 2018, 3:55am UTC](https://discourse.chef.io/t/scheduling-a-chef-client-run/12315/7 "2018-01-02T03:55:37Z")

</div>

The way I’ve done this is by getting the time to run the update from our ticketing system, so I used an API call to get that info, I suppose you could use a tag or attribute if you don’t go the API route. Then I used the the [cron resource](https://docs.chef.io/resource_cron.html) to set the schedule (time to patch) and a script that I copy over using the [cookbook\_file](https://docs.chef.io/resource_cookbook_file.html) resource.

What you’re trying to do is very possible with Chef.
