How to use service to restart supervisor


#1

Hi

I use supervisor and I want to restart a service e.g…

bash “restart_supervisorctl_master” do
code <<-EOH
sudo supervisorctl restart master_server:
EOH
action :nothing
end

template “/etc/supervisor/conf.d/master.conf” do
path "/etc/supervisor/conf.d/master.conf"
source "supervisord.master.conf.erb"
owner "root"
group "root"
mode "0755"
variables :version => version
notifies :run, ‘bash[restart_supervisorctl_master]’, :delayed
end

But if I wanted to restart supervisor I would the below but would restart
every service in supervisor.
service “supervisord”

notifies :restart, resources(:service => “supervisord”)

So…it there a more chefonic method for defining a service for
supervisorctl so I can restart using notifies :restart, resources(:service
=> “supervisorctl master_server”)?

Thanks


#2

Use the supervisor cookbook, which provides resources for each service within supervisord and actions to restart them like you would with any other service resource.

–Noah

On Sep 6, 2013, at 8:55 PM, David Montgomery wrote:

Hi

I use supervisor and I want to restart a service e.g…

bash “restart_supervisorctl_master” do
code <<-EOH
sudo supervisorctl restart master_server:
EOH
action :nothing
end

template “/etc/supervisor/conf.d/master.conf” do
path "/etc/supervisor/conf.d/master.conf"
source "supervisord.master.conf.erb"
owner "root"
group "root"
mode "0755"
variables :version => version
notifies :run, ‘bash[restart_supervisorctl_master]’, :delayed
end

But if I wanted to restart supervisor I would the below but would restart every service in supervisor.
service “supervisord”

notifies :restart, resources(:service => “supervisord”)

So…it there a more chefonic method for defining a service for supervisorctl so I can restart using notifies :restart, resources(:service => “supervisorctl master_server”)?

Thanks