Make sure the status command actually works and returns proper exit
statuses that reflect if the service is running. For example, if the
status command is broken and always returns 0 then chef would think
the service was running already and wouldn't try to start it. This
would create the behavior you describe. Also, you can do a run in
debug (chef-client -l debug) and you'll get a little more info back
when it checks whether or not to start the service.
If you find the status command is broken, you can either fix it or
switch to using the pattern attribute to the service resource to cause
the provider to grep the process list rather than using the init
script's status command.
KC
On Fri, Jan 13, 2012 at 3:19 PM, Hector Castro < "> > wrote:
> Hi Arthur,
>
> From the looks of your template, it appears that you're trying to write an
> Upstart script. I would first double-check to make sure that the Chef
> service provider given your operating system is looking in that directory
> for init scripts:
>
> http://wiki.opscode.com/display/chef/Resources#Resources-Service
>
> Secondly, I would check to make sure that the PID Upstart is capturing from
> `inspircd` (you can get this by checking the status of the service) is the
> same as the one you see in `ps aux | grep inspired`. Upstart will capture
> the PID of the parent process (that spawned the daemon) instead of the child
> process (the actual daemon).
>
> --
> Hector
>
> On Friday, January 13, 2012 at 5:38 PM, Arthur Kalmenson wrote:
>
> Hello everyone,
>
> I'm building a cookbook that installs InspIRCd from source. It doesn't
> install an init.d script, so I made my own in templates. However, I'm
> finding that the call to the service resource doesn't start the IRC server,
> even though the chef-client output seems to indicate it does. I am, however,
> able to start it via "sudo /etc/init.d/inspircd start" or "sudo service
> inspircd start". Here's some code snippets:
>
> inspircd.initd.erb
>
> #!/bin/bash
> #
> # init.d script for inspircd
>
> su - irc -c "<%= "#{node['inspircd']['install_dir']}" %>/inspircd $*"
>
>
> default.rb
>
> template "/etc/init.d/inspircd" do
> source "inspircd.initd.erb"
> owner "root"
> group "root"
> mode "0744"
> end
>
> service "inspircd" do
> supports :status => true, :restart => true
> action [ :enable, :start ]
> end
>
>
> chef-client output
>
> ....
> [Fri, 13 Jan 2012 17:29:02 -0500] INFO: Processing
> template[/etc/init.d/inspircd] action create (inspircd::default line 72)
> [Fri, 13 Jan 2012 17:29:02 -0500] INFO: Processing service[inspircd] action
> enable (inspircd::default line 79)
> [Fri, 13 Jan 2012 17:29:02 -0500] INFO: Processing service[inspircd] action
> start (inspircd::default line 79)
> [Fri, 13 Jan 2012 17:29:02 -0500] INFO: Chef Run complete in 0.6536 seconds
> [Fri, 13 Jan 2012 17:29:02 -0500] INFO: Running report handlers
> [Fri, 13 Jan 2012 17:29:02 -0500] INFO: Report handlers complete
>
> Any help would be appreciated. Thank you.
>
> All the best,
> --
> Arthur Kalmenson
>
>
Archive powered by MHonArc 2.6.16.