On 05/31/2010 08:57 PM, Joshua Miller wrote:
Here is what I do for my debian package installs, one problem I have not fixed is it does not reload chef upstart when the values change ... new to upstart and a restart does not pickup the new vars so I have to figure it out later. Since I dont change it much I have not really cared.
thanks for sharing. I adopted your recipe, but turned the service into the task run by cron. RAM is precious resource on VPS.
I couldn't find a proper way to calculate times for cron, though. Also I think /etc/init.d/chef-client is not really necessary.
This what is have for now:
$ cat chef/recipes/client-deb.rb
case node[:platform]
when "ubuntu"
if node[:platform_version].to_f >= 9.10
service "chef-client" do
provider Chef::Provider::Service::Upstart
supports :restart => true, :reload => true
end
template "/etc/init/chef-client.conf" do
source "upstart-chef-client.conf.erb"
owner "root"
group "root"
mode 0644
backup 0
notifies :start, resources(:service => "chef-client")
not_if do File.symlink?("/etc/init.d/chef-server") end
end
cron "chef-client" do
minute ((0..59).to_a.delete_if {|x| x % (@node[:chef] [:client_interval].to_i / 60) != 0 }.join ",")
command "service chef-client start"
end
end
end
% cat chef/templates/default/upstart-chef-client.conf.erb
start on runlevel [2345]
task
script
exec /usr/bin/env chef-client -c /etc/chef/client.rb -s <%= @node[:chef][:client_splay] %>
end script
Archive powered by MHonArc 2.6.16.