Execute only if file updated?

All,

Is there a way to make chef run an execute ONLY IF a file is updated?
Otherwise, never?

Doug

You can give it action :nothing, then make it subscribe :run to the
file block, or have the file block notify :run the execute block.

On Thu, Dec 4, 2014 at 12:17 PM, Douglas Garstang doug.garstang@gmail.com
wrote:

All,

Is there a way to make chef run an execute ONLY IF a file is updated?
Otherwise, never?

Doug

Sure - make its action :none, and notify it from the execute resource.

Adam

On Thu, Dec 4, 2014 at 9:17 AM, Douglas Garstang doug.garstang@gmail.com
wrote:

All,

Is there a way to make chef run an execute ONLY IF a file is updated?
Otherwise, never?

Doug

file '/tmp/foo.txt' do

content 'foo'

notifies :run, 'execute[bar]'

end

execute 'bar' do

command 'echo bar'

action :nothing

end

On Thu, Dec 4, 2014 at 9:18 AM, Douglas Garstang doug.garstang@gmail.com
wrote:

All,
Is there a way to make chef run an execute ONLY IF a file is updated?
Otherwise, never?
Doug

You can extrapolate the idea in the accepted answer here

Chris

From: Douglas Garstang [mailto:doug.garstang@gmail.com]
Sent: Thursday, December 04, 2014 12:18 PM
To: chef@lists.opscode.com
Subject: [chef] Execute only if file updated?

All,
Is there a way to make chef run an execute ONLY IF a file is updated? Otherwise, never?

Doug

Thanks folks.

On Thu, Dec 4, 2014 at 11:41 AM, Fouts, Chris Chris.Fouts@sensus.com
wrote:

You can extrapolate the idea in the accepted answer here

What is the best way in ruby to check if a file was actually modified? - Stack Overflow

Chris

From: Douglas Garstang [mailto:doug.garstang@gmail.com]
Sent: Thursday, December 04, 2014 12:18 PM
To: chef@lists.opscode.com
Subject: [chef] Execute only if file updated?

All,

Is there a way to make chef run an execute ONLY IF a file is updated?
Otherwise, never?

Doug

--
Regards,

Douglas Garstang
http://www.linkedin.com/in/garstang
Email: doug.garstang@gmail.com
Cell: +1-805-340-5627