Service resource not creating a file


#1

Hi Chefellas,

I have the following service resource defined in my recipe.

service "unicorn_#{app['id']}" do
  provider Chef::Provider::Service::Init::Debian
  start_command "#{app['deploy_to']}/shared/scripts/unicorn start"
  stop_command "#{app['deploy_to']}/shared/scripts/unicorn stop"
  restart_command "#{app['deploy_to']}/shared/scripts/unicorn restart"
  status_command "#{app['deploy_to']}/shared/scripts/unicorn status"
  supports :start => true, :stop => true, :restart => true, :status => true
  action :nothing
end

According to the docs at wiki http://wiki.opscode.com/display/chef/Resources#Resources-Service, it should create a file at /etc/init.d/unicorn_myapp file.

But its not creating that file.

I’m on chef-0.10.8 with ruby19

What might be wrong?


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


#2

Hello Sachin,

The service resource doesn’t actually deploy anything to /etc/init.d, its
actually just designed to manage the service. If you check the docs it
doesn’t actually say it puts a file in /etc/init.d, rather it says it uses
the file at /etc/init.d ( eg: /etc/init.d/service_name), but the does
needs to actually exist prior to this call. What you probably want to do
is deploy a template to /etc/init.d just before you call your service
resource ( https://gist.github.com/2814835 ).

Hope that helps!

-John

On Sun, May 27, 2012 at 11:19 AM, Sachin Sagar Rai millisami@gmail.comwrote:

Hi Chefellas,

I have the following service resource defined in my recipe.

service "unicorn_#{app['id']}" do
  provider Chef::Provider::Service::Init::Debian
  start_command "#{app['deploy_to']}/shared/scripts/unicorn start"
  stop_command "#{app['deploy_to']}/shared/scripts/unicorn stop"
  restart_command "#{app['deploy_to']}/shared/scripts/unicorn restart"
  status_command "#{app['deploy_to']}/shared/scripts/unicorn status"
  supports :start => true, :stop => true, :restart => true, :status =>

true
action :nothing
end

According to the docs at wiki
http://wiki.opscode.com/display/chef/Resources#Resources-Service, it
should create a file at /etc/init.d/unicorn_myapp file.

But its not creating that file.

I’m on chef-0.10.8 with ruby19

What might be wrong?


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow http://www.sparrowmailapp.com/?sig


#3

@John, Thanks. That really helped out.


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Sunday, May 27, 2012 at 9:28 PM, John Dyer wrote:

Hello Sachin,

The service resource doesn’t actually deploy anything to /etc/init.d, its actually just designed to manage the service. If you check the docs it doesn’t actually say it puts a file in /etc/init.d, rather it says it uses the file at /etc/init.d ( eg: /etc/init.d/service_name), but the does needs to actually exist prior to this call. What you probably want to do is deploy a template to /etc/init.d just before you call your service resource ( https://gist.github.com/2814835 ).

Hope that helps!

-John

On Sun, May 27, 2012 at 11:19 AM, Sachin Sagar Rai <millisami@gmail.com (mailto:millisami@gmail.com)> wrote:

Hi Chefellas,

I have the following service resource defined in my recipe.

service "unicorn_#{app['id']}" do
  provider Chef::Provider::Service::Init::Debian
  start_command "#{app['deploy_to']}/shared/scripts/unicorn start"
  stop_command "#{app['deploy_to']}/shared/scripts/unicorn stop"
  restart_command "#{app['deploy_to']}/shared/scripts/unicorn restart"
  status_command "#{app['deploy_to']}/shared/scripts/unicorn status"
  supports :start => true, :stop => true, :restart => true, :status => true
  action :nothing
end

According to the docs at wiki http://wiki.opscode.com/display/chef/Resources#Resources-Service, it should create a file at /etc/init.d/unicorn_myapp file.

But its not creating that file.

I’m on chef-0.10.8 with ruby19

What might be wrong?


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)