Chef "execute" question

Let’s say I have:

execute “something” do
command "/usr/local/bin/somescript"
action :run
end
Will Chef execute that command on every client run? If not how do I make it execute the command on each client run?


Justin Franks
Lead Operations Engineer
SaaS, Cloud, Data Centers & Infrastructure
Lithium Technologies, Inc
225 Bush St., 15th Floor
San Francisco, CA 94104
tel: +1 415 757 3100 x3219

Yes. In this form chef will execute the command in every run
On Jul 21, 2014 8:39 AM, "Justin Franks" justin.franks@lithium.com wrote:

Let's say I have:

execute "something" do
command "/usr/local/bin/somescript"
action :run
end
Will Chef execute that command on every client run? If not how do I make
it execute the command on each client run?


Justin Franks
Lead Operations Engineer
SaaS, Cloud, Data Centers & Infrastructure
Lithium Technologies, Inc
225 Bush St., 15th Floor
San Francisco, CA 94104
tel: +1 415 757 3100 x3219

On Monday, July 21, 2014 at 8:39 AM, Justin Franks wrote:

Let's say I have:
execute "something" do
command "/usr/local/bin/somescript"
action :run
end
Will Chef execute that command on every client run? If not how do I make it execute the command on each client run?

There’s two common ways to do this, depending on what you need. If you need this to execute in response to a change in a different resource, such as a file being updated or a service restarted, then you want to use action :nothing and have the other resource notify your execute resource to run. See: Common Resource Functionality

If your execute resource is more like a “poor man’s LWRP”, that is, it independently manages some system state unrelated to other resources, then you can use a guard command to make the execution conditional based on results of that command. See: Common Resource Functionality


Justin Franks
Lead Operations Engineer
SaaS, Cloud, Data Centers & Infrastructure
Lithium Technologies, Inc
225 Bush St., 15th Floor
San Francisco, CA 94104
tel: +1 415 757 3100 x3219

HTH,

Daniel DeLeo

I want the chef "execute" to run a script on every chef run. So instead of using cron I want to use Chef "execute"


Justin Franks
Lead Operations Engineer
SaaS, Cloud, Data Centers & Infrastructure
Lithium Technologies, Inc
225 Bush St., 15th Floor
San Francisco, CA 94104
tel: +1 415 757 3100 x3219


From: Daniel DeLeo ddeleo@kallistec.com on behalf of Daniel DeLeo dan@kallistec.com
Sent: Monday, July 21, 2014 8:58 AM
To: chef@lists.opscode.com
Subject: [chef] Re: Chef "execute" question

On Monday, July 21, 2014 at 8:39 AM, Justin Franks wrote:

Let's say I have:
execute "something" do
command "/usr/local/bin/somescript"
action :run
end
Will Chef execute that command on every client run? If not how do I make it execute the command on each client run?

There’s two common ways to do this, depending on what you need. If you need this to execute in response to a change in a different resource, such as a file being updated or a service restarted, then you want to use action :nothing and have the other resource notify your execute resource to run. See: Common Resource Functionality

If your execute resource is more like a “poor man’s LWRP”, that is, it independently manages some system state unrelated to other resources, then you can use a guard command to make the execution conditional based on results of that command. See: Common Resource Functionality


Justin Franks
Lead Operations Engineer
SaaS, Cloud, Data Centers & Infrastructure
Lithium Technologies, Inc
225 Bush St., 15th Floor
San Francisco, CA 94104
tel: +1 415 757 3100 x3219

HTH,

Daniel DeLeo

Yes it will be executed at every chef run.

On Mon, Jul 21, 2014 at 9:35 PM, Justin Franks justin.franks@lithium.com
wrote:

I want the chef "execute" to run a script on every chef run. So instead of
using cron I want to use Chef "execute"


Justin Franks
Lead Operations Engineer
SaaS, Cloud, Data Centers & Infrastructure
Lithium Technologies, Inc
225 Bush St., 15th Floor
San Francisco, CA 94104
tel: +1 415 757 3100 x3219


From: Daniel DeLeo ddeleo@kallistec.com on behalf of Daniel DeLeo <
dan@kallistec.com>
Sent: Monday, July 21, 2014 8:58 AM
To: chef@lists.opscode.com
Subject: [chef] Re: Chef "execute" question

On Monday, July 21, 2014 at 8:39 AM, Justin Franks wrote:

Let's say I have:
execute "something" do
command "/usr/local/bin/somescript"
action :run
end
Will Chef execute that command on every client run? If not how do I make
it execute the command on each client run?

There’s two common ways to do this, depending on what you need. If you
need this to execute in response to a change in a different resource, such
as a file being updated or a service restarted, then you want to use
action :nothing and have the other resource notify your execute resource
to run. See: Common Resource Functionality

If your execute resource is more like a “poor man’s LWRP”, that is, it
independently manages some system state unrelated to other resources, then
you can use a guard command to make the execution conditional based on
results of that command. See:
Common Resource Functionality


Justin Franks
Lead Operations Engineer
SaaS, Cloud, Data Centers & Infrastructure
Lithium Technologies, Inc
225 Bush St., 15th Floor
San Francisco, CA 94104
tel: +1 415 757 3100 x3219

HTH,

Daniel DeLeo