My requirement is this:
- Look for changes in the file /tmp/file
- If there is a change, execute these in the following order:
- run command3
- run command2
- run command1
- If there is NO change in the file /tmp/file, do nothing.
My code is like this:
exec { 'exec3':
command => 'command3',
require => File['file'],
}
exec { 'exec2':
command => 'command2',
require => Exec['exec3'],
}
exec { 'exec1':
command => 'command1',
require => Exec['exec2'],
subscribe => File['file'],
refreshonly => true,
}
But, whether there is a change to /tmp/file or not, command3 and command2 always runs. How do I prevent it? I do not want "require" to be run in exec1 when there is no change to /tmp/file.