以下是我安装monit的秘诀。我每60秒运行一次厨师客户端进行调试。
厨师如果重启monit evry 60秒。我不能阻止吗?我想如果更换一个模板,厨师将重新启动。
[Fri, 30 Mar 2012 06:12:18 +0000] INFO: Processing package[monit] action install (monit::default line 5)
[Fri, 30 Mar 2012 06:12:18 +0000] INFO: Processing service[monit] action enable (monit::default line 9)
[Fri, 30 Mar 2012 06:12:18 +0000] INFO: Processing service[monit] action start (monit::default line 9)
[Fri, 30 Mar 2012 06:12:18 +0000] INFO: Processing template[monitrc] action create (monit::default line 14)
[Fri, 30 Mar 2012 06:12:18 +0000] INFO: template[monitrc] mode changed to 644
[Fri, 30 Mar 2012 06:12:18 +0000] INFO: template[monitrc] sending restart action to service[monit] (immediate)
[Fri, 30 Mar 2012 06:12:18 +0000] INFO: Processing service[monit] action restart (monit::default line 9)
[Fri, 30 Mar 2012 06:12:22 +0000] INFO: service[monit] restarted
[Fri, 30 Mar 2012 06:12:22 +0000] INFO: Processing template[monitstart] action create (monit::default line 25)
package "monit" do
action :install
end
service "monit" do
supports :status => true, :restart => true, :start => true,:stop => true
action [ :enable, :start ]
end
template "monitrc" do
path "/etc/monit/monitrc"
source "monitrc.erb"
owner "root"
group "root"
mode "0644"
#notifies :restart, resources(:service => "monit")
#notifies :restart, "service[monit]"
notifies :restart, resources(:service => "monit"), :immediate
end
template "monitstart" do
path "/etc/default/monit"
source "monit.erb"
owner "root"
group "root"
mode "0644"
notifies :restart, "service[monit]"
#notifies :restart, resources(:service => "monit"), :immediate
end
答案 0 :(得分:5)
每次monit服务重新启动时,它都会将文件/etc/monit/monitrc
权限更改为600,因此只有root才能读取它,可能是某种安全强化。
但是当你的食谱运行时,它将权限更改为644,重新启动服务,将文件放回600.这就像一条狗追逐自己的尾巴。
一个简单的解决方案是更改您的配方,在模板上应用600,避免重启。