# Trouble getting service to start

**URL:** <https://discourse.chef.io/t/trouble-getting-service-to-start/2471>\
**Category:** Chef Infra (archive)\
**Created:** [February 18, 2012, 7:26pm UTC](https://discourse.chef.io/t/trouble-getting-service-to-start/2471 "2012-02-18T19:26:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff\_Stroomer](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@Jeff\_Stroomer](https://discourse.chef.io/u/Jeff_Stroomer)\
**Post date:** [February 18, 2012, 7:26pm UTC](https://discourse.chef.io/t/trouble-getting-service-to-start/2471/1 "2012-02-18T19:26:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![KC\_Braunschweig](https://avatars.discourse-cdn.com/v4/letter/k/ea5d25/32.png) [@KC\_Braunschweig](https://discourse.chef.io/u/KC_Braunschweig)\
**Post date:** [February 18, 2012, 7:55pm UTC](https://discourse.chef.io/t/trouble-getting-service-to-start/2471/2 "2012-02-18T19:55:46Z")

</div>

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](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](mailto: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

---

<div class="post-metadata">

**Author:** ![Jeff\_Stroomer](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@Jeff\_Stroomer](https://discourse.chef.io/u/Jeff_Stroomer)\
**Post date:** [February 18, 2012, 10:39pm UTC](https://discourse.chef.io/t/trouble-getting-service-to-start/2471/3 "2012-02-18T22:39:27Z")

</div>

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](mailto:kcbraunschweig@gmail.com)]  
Sent: Saturday, February 18, 2012 12:56 PM  
To: [chef@lists.opscode.com](mailto: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](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](mailto: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
