# Disable chef-client?

**URL:** https://discourse.chef.io/t/disable-chef-client/5836
**Category:** Chef Infra (archive)
**Created:** [October 22, 2014, 3:49pm UTC](https://discourse.chef.io/t/disable-chef-client/5836 "2014-10-22T15:49:14Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Douglas\_Garstang](https://avatars.discourse-cdn.com/v4/letter/d/c2a13f/32.png) [@Douglas\_Garstang](https://discourse.chef.io/u/Douglas_Garstang)
#### Post date: [October 22, 2014, 3:49pm UTC](https://discourse.chef.io/t/disable-chef-client/5836/1 "2014-10-22T15:49:14Z")

</div>

All,

When the chef-client is running as a daemon, is there a way to keep the  
client running as a daemon, but temporarily put it into NOOP mode?

Doug

---

<div class="post-metadata">

### Author: ![Peter\_Burkholder1](https://avatars.discourse-cdn.com/v4/letter/p/7ea924/32.png) [@Peter\_Burkholder1](https://discourse.chef.io/u/Peter_Burkholder1)
#### Post date: [October 22, 2014, 7:18pm UTC](https://discourse.chef.io/t/disable-chef-client/5836/2 "2014-10-22T19:18:11Z")

</div>

Lockfile? See

> **[Chef 11 In-Depth: Client Improvements - Chef Blog | Chef](https://www.chef.io/blog/chef-11-in-depth-client-improvements)**
>
> Chef 11: New features like chef-apply, formatted output, template partials, and run locking enhance client-side efficiency and usability.

and

# In client.rb or solo.rb

lockfile "/not-nfs/chef-lockfile.pid"

On Wed, Oct 22, 2014 at 11:49 AM, Douglas Garstang [doug.garstang@gmail.com](mailto:doug.garstang@gmail.com)  
wrote:

> All,
> 
> When the chef-client is running as a daemon, is there a way to keep the  
> client running as a daemon, but temporarily put it into NOOP mode?
> 
> Doug

---

<div class="post-metadata">

### Author: ![kallistec](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kallistec/32/23_2.png) [@kallistec](https://discourse.chef.io/u/kallistec)
#### Post date: [October 22, 2014, 10:13pm UTC](https://discourse.chef.io/t/disable-chef-client/5836/3 "2014-10-22T22:13:33Z")

</div>

On Wednesday, October 22, 2014 at 12:18 PM, Peter Burkholder wrote:

> Lockfile? See [Chef 11 In-Depth: Client Improvements - Chef Blog | Chef](https://www.getchef.com/blog/2013/02/06/chef-11-in-depth-client-improvements/) and
> 
> # In client.rb or solo.rb
> 
> lockfile "/not-nfs/chef-lockfile.pid"

Chef uses flocks to ensure that there is a live “owner” of this lockfile, and depending on configuration, the default behavior if the lock isn’t available is for chef to wait, so this isn’t really a good option.

> On Wed, Oct 22, 2014 at 11:49 AM, Douglas Garstang \<[doug.garstang@gmail.com](mailto:doug.garstang@gmail.com) ([mailto:doug.garstang@gmail.com](mailto:doug.garstang@gmail.com))\> wrote:
> 
> > All,
> > 
> > When the chef-client is running as a daemon, is there a way to keep the client running as a daemon, but temporarily put it into NOOP mode?
> > 
> > Doug  
> > Doug,

There’s nothing built-in to do this. You could maybe experiment with using a data bag item to drive recipe code that would set `Chef::Config[:why_run]` to true, but I’m not sure it will work. Though we do something similar with a “suicide” cookbook that makes chef-client abort early if a certain data bag item contains a specific value (and we added some scripts to change the data bag item easily from the command line.

HTH,

--  
Daniel DeLeo

---

<div class="post-metadata">

### Author: ![Tensibai](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/tensibai/32/29_2.png) [@Tensibai](https://discourse.chef.io/u/Tensibai)
#### Post date: [October 22, 2014, 10:22pm UTC](https://discourse.chef.io/t/disable-chef-client/5836/4 "2014-10-22T22:22:34Z")

</div>

My point of view: I would use a tag or an attribute and a top level (in run list) recipe aborting (gracefully if possible, can't remember this) the chef run if the tag is present.

---- Douglas Garstang a écrit ----

> All,
> 
> When the chef-client is running as a daemon, is there a way to keep the client running as a daemon, but temporarily put it into NOOP mode?
> 
> Doug

---

<div class="post-metadata">

### Author: ![Tensibai](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/tensibai/32/29_2.png) [@Tensibai](https://discourse.chef.io/u/Tensibai)
#### Post date: [October 23, 2014, 8:28am UTC](https://discourse.chef.io/t/disable-chef-client/5836/5 "2014-10-23T08:28:22Z")

</div>

you may even use the resource "omnibus chef killer" from

> <https://github.com/chef-boneyard/omnibus_updater/blob/master/recipes/installer.rb>

as a starting point for yours.

Le 2014-10-23 00:22, Tensibai Zhaoying a écrit :

> My point of view: I would use a tag or an attribute and a top level (in run list) recipe aborting (gracefully if possible, can't remember this) the chef run if the tag is present.
> 
> ---- Douglas Garstang a écrit ----
> 
> All,
> 
> When the chef-client is running as a daemon, is there a way to keep the client running as a daemon, but temporarily put it into NOOP mode?
> 
> Doug
