How to tell if Chef client is installed on Linux?

IAmYourFaja picture IAmYourFaja · Jul 18, 2014 · Viewed 7.1k times · Source

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?

Answer

StephenKing picture StephenKing · Jul 18, 2014

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.