it will get executed again (or execute the command specified in
“refresh“, if there is one).
– **refresh**
How to refresh this command. By default, the exec is just
called again when it receives an event from another resource,
but this parameter allows you to define a different command
for refreshing.
– **refreshonly**
The command should only be run as a
refresh mechanism for when a dependent object is changed. It only
makes sense to use this option when this command depends on some
other object; it is useful for triggering an action::
# Pull down the main aliases file
file { “/etc/aliases”:
source => “puppet://server/module/aliases”
}
# Rebuild the database, but only when the file changes
exec { newaliases:
path => [“/usr/bin”, “/usr/sbin”],
subscribe => File[“/etc/aliases”],
refreshonly => true
}
Note that only “subscribe“ and “notify“ can trigger actions, not
“require“,
so it only makes sense to use “refreshonly“ with “subscribe“ or
“notify“. Valid values are “true“, “false“.
refresh可能不太好理解,但refreshonly在pi命令中解释的比较清楚
如果没有refreshonly时,即使没有事件通知它,exec也会执行
如果加上refreshonly时,exec仅在其他资源用notify或subscribe事件通知时才会执行。refreshonly作用是让exec只在通知时执行,如果被通知多次就执行多次。
转载于:https://blog.51cto.com/dywer/688808
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/110536.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...