Trouble getting service to start

Chef folks,

I’m having trouble getting a service to start using the chef service
resource. If I do either of the following

service “brisk” do
action [:enable, :start]
end

service “brisk” do
action [:enable, :start]
start_command "/etc/init.d/brisk start"
end

then brisk doesn’t start, and I see no signs anywhere of trouble, except that
the service isn’t running, and there’s no log file for brisk. But if
instead I do

execute “start_brisk” do
command "/etc/init.d/brisk start"
action :run
end

then brisk starts up the way it should. Any thoughts about what I’m doing
wrong? If it makes a difference, the target machine is RedHat 5.5.

Thanks in advance for the help,

Jeff Stroomer

Debug output should help make it more clear, but check if your init
script works properly. On RedHat, the provider assumes the init script
will support a status command. It will try to do a status check to see
if the service is running before starting it. If the status command
isn't supported or implemented wrong (doesn't set expected exit
status), chef may get the impression the service is running when it
isn't and therefore not try to start it.

If you can't fix the init script, you can make chef use the generic
init provider and then grep the process list rather than use status
(this is to work around http://tickets.opscode.com/browse/CHEF-2345).

It looks like:

service "brisk" do
action [:enable, :start]
provider Chef::Provider::Service::Init
pattern 'brisk'
end

KC

On Sat, Feb 18, 2012 at 11:26 AM, jeff.stroomer@disney.com wrote:

Chef folks,

I’m having trouble getting a service to start using the chef service
resource. If I do either of the following

service "brisk" do
action [:enable, :start]
end

service "brisk" do
action [:enable, :start]
start_command "/etc/init.d/brisk start"
end

then brisk doesn’t start, and I see no signs anywhere of trouble, except that
the service isn’t running, and there’s no log file for brisk. But if
instead I do

execute "start_brisk" do
command "/etc/init.d/brisk start"
action :run
end

then brisk starts up the way it should. Any thoughts about what I’m doing
wrong? If it makes a difference, the target machine is RedHat 5.5.

Thanks in advance for the help,

Jeff Stroomer

KC,

Thank you for the advice. Your advice was 100% right, and I would have never tracked down that problem myself.

Jeff

-----Original Message-----
From: KC Braunschweig [mailto:kcbraunschweig@gmail.com]
Sent: Saturday, February 18, 2012 12:56 PM
To: chef@lists.opscode.com
Subject: [chef] Re: trouble getting service to start

Debug output should help make it more clear, but check if your init
script works properly. On RedHat, the provider assumes the init script
will support a status command. It will try to do a status check to see
if the service is running before starting it. If the status command
isn't supported or implemented wrong (doesn't set expected exit
status), chef may get the impression the service is running when it
isn't and therefore not try to start it.

If you can't fix the init script, you can make chef use the generic
init provider and then grep the process list rather than use status
(this is to work around http://tickets.opscode.com/browse/CHEF-2345).

It looks like:

service "brisk" do
action [:enable, :start]
provider Chef::Provider::Service::Init
pattern 'brisk'
end

KC

On Sat, Feb 18, 2012 at 11:26 AM, jeff.stroomer@disney.com wrote:

Chef folks,

I'm having trouble getting a service to start using the chef service
resource. If I do either of the following

service "brisk" do
action [:enable, :start]
end

service "brisk" do
action [:enable, :start]
start_command "/etc/init.d/brisk start"
end

then brisk doesn't start, and I see no signs anywhere of trouble, except that
the service isn't running, and there's no log file for brisk. But if
instead I do

execute "start_brisk" do
command "/etc/init.d/brisk start"
action :run
end

then brisk starts up the way it should. Any thoughts about what I'm doing
wrong? If it makes a difference, the target machine is RedHat 5.5.

Thanks in advance for the help,

Jeff Stroomer