Search code examples
linuxprocesschef-infraknife

How to tell if Chef client is installed on Linux?


I need a programmatic way (any way) to tell if Chef client is installed on Linux. The only way I can think of is to see if /etc/chef exists, but this might not be fool-proof. I was also thinking about checking to see the output of a knife command, but my understanding of Chef client is that knife is not an obligatory part of the client installation. In other words, I believe it's possible for the client to be installed, but not knife. Thoughts?


Solution

  • You can use which knife or which chef-client to determine (exist status 0: command found, otherwise 1).

    While knife is used on the workstation, it should come with every installation of chef. But to be save, check for chef-client.