0

Im using chef to automate my production environment. One such production installation follows the process of

  • Installing a package from local repository
  • Restarting a service using svc deamontools ( eg svc -u service_name)

I know chef provides a resource called "package" to install a package from repository. But, is there a resource to restart/reload a deamontool service?

The below resource, would start/stop the services controlled by init.d. But I'm looking to control the services from svc deamontools. Any pointers would be much appreciated.

service 'nginx' do action [ :enable, :start ] end

1 Answers1

1

Preamble:

The service resource supports more than just init.d.

The service resource itself should guess which provider to use, if not you'll have to specify it with the provider attribute

Documentation is here.

Answer

As far as I know there's no builtin provider for daemontools, so there's the daemontools cookbook which could take care of all of this for you.

Another way to accomplish this is using the start, stop, status command attributes like this:

service "service_name" do
  support supports :status => true
  start_command "svc -u #{service_name}"
  stop_command "...."
  status_command "...."
  action :start
end

There's other attributes in the documentation of the service resource linked in preamble

Tensibai
  • 15,557
  • 1
  • 37
  • 57