# Trouble reloading a service

**URL:** <https://discourse.chef.io/t/trouble-reloading-a-service/2941>\
**Category:** Chef Infra (archive)\
**Created:** [July 20, 2012, 11:20pm UTC](https://discourse.chef.io/t/trouble-reloading-a-service/2941 "2012-07-20T23:20:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allan\_Wind](https://avatars.discourse-cdn.com/v4/letter/a/ac91a4/32.png) [@Allan\_Wind](https://discourse.chef.io/u/Allan_Wind)\
**Post date:** [July 20, 2012, 11:20pm UTC](https://discourse.chef.io/t/trouble-reloading-a-service/2941/1 "2012-07-20T23:20:07Z")

</div>

I am restarting a service with chef 0.10.4 along these lines:

template ‘/etc/logfmon.conf’ do  
notifies :restart, ‘service[logfmon]’  
…  
end

service ‘logfmon’ do  
action [:enable, :start]  
supports :reload =\> true, :restart =\> true, :status =\> false  
end

and this works just fine:

\*\* [out :: [s2.leadkarma.com](http://s2.leadkarma.com)] [Fri, 20 Jul 2012 23:13:39 +0000] INFO: template[/etc/logfmon.conf] sending restart action to service[logfmon] (delayed)  
\*\* [out :: [s2.leadkarma.com](http://s2.leadkarma.com)] [Fri, 20 Jul 2012 23:13:39 +0000] INFO: Processing service[logfmon] action restart (logfmon::default line 61)  
\*\* [out :: [s2.leadkarma.com](http://s2.leadkarma.com)] [Fri, 20 Jul 2012 23:13:39 +0000] DEBUG: service[logfmon] supports status, running  
\*\* [out :: [s2.leadkarma.com](http://s2.leadkarma.com)] [Fri, 20 Jul 2012 23:13:40 +0000] INFO: service[logfmon] restarted

and my service is being called:

status  
status  
start  
status  
restart

It is weird that “supports … :status =\> false” is not honored, but more trouble is that  
changing the notifies :restart to :reload means that only these commands are issued to  
my init script (i.e. not reload):

status  
status  
start  
status

Any ideas?

## /Allan

Allan Wind  
Life Integrity, LLC  
[http://lifeintegrity.com](http://lifeintegrity.com)

---

<div class="post-metadata">

**Author:** ![AJ\_Christensen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aj_christensen/32/525_2.png) [@AJ\_Christensen](https://discourse.chef.io/u/AJ_Christensen)\
**Post date:** [July 20, 2012, 11:23pm UTC](https://discourse.chef.io/t/trouble-reloading-a-service/2941/2 "2012-07-20T23:23:55Z")

</div>

What platform? I think the Redhat service provider has supports  
:status forced to 'true' always or something dumb like that.

Can you show the full -l debug stack trace regarding your provider  
taking action?

--AJ

On 21 July 2012 11:20, Allan Wind [allan\_wind@lifeintegrity.com](mailto:allan_wind@lifeintegrity.com) wrote:

> I am restarting a service with chef 0.10.4 along these lines:
> 
> template '/etc/logfmon.conf' do  
> notifies :restart, 'service[logfmon]'  
> ...  
> end
> 
> service 'logfmon' do  
> action [:enable, :start]  
> supports :reload =\> true, :restart =\> true, :status =\> false  
> end
> 
> and this works just fine:
> 
> \*\* [out :: [s2.leadkarma.com](http://s2.leadkarma.com)] [Fri, 20 Jul 2012 23:13:39 +0000] INFO: template[/etc/logfmon.conf] sending restart action to service[logfmon] (delayed)  
> \*\* [out :: [s2.leadkarma.com](http://s2.leadkarma.com)] [Fri, 20 Jul 2012 23:13:39 +0000] INFO: Processing service[logfmon] action restart (logfmon::default line 61)  
> \*\* [out :: [s2.leadkarma.com](http://s2.leadkarma.com)] [Fri, 20 Jul 2012 23:13:39 +0000] DEBUG: service[logfmon] supports status, running  
> \*\* [out :: [s2.leadkarma.com](http://s2.leadkarma.com)] [Fri, 20 Jul 2012 23:13:40 +0000] INFO: service[logfmon] restarted
> 
> and my service is being called:
> 
> status  
> status  
> start  
> status  
> restart
> 
> It is weird that "supports ... :status =\> false" is not honored, but more trouble is that  
> changing the notifies :restart to :reload means that only these commands are issued to  
> my init script (i.e. not reload):
> 
> status  
> status  
> start  
> status
> 
> Any ideas?
> 
> ## /Allan
> 
> Allan Wind  
> Life Integrity, LLC  
> [http://lifeintegrity.com](http://lifeintegrity.com)

---

<div class="post-metadata">

**Author:** ![Allan\_Wind](https://avatars.discourse-cdn.com/v4/letter/a/ac91a4/32.png) [@Allan\_Wind](https://discourse.chef.io/u/Allan_Wind)\
**Post date:** [July 20, 2012, 11:44pm UTC](https://discourse.chef.io/t/trouble-reloading-a-service/2941/3 "2012-07-20T23:44:11Z")

</div>

On 2012-07-21 11:23:55, AJ Christensen wrote:

> Can you show the full -l debug stack trace regarding your provider  
> taking action?

I generated this trace centos with chef 0.10.10 but seeing the  
same issue: [http://pastebin.com/xCTdhXNY](http://pastebin.com/xCTdhXNY).

## /Allan

Allan Wind  
Life Integrity, LLC  
[http://lifeintegrity.com](http://lifeintegrity.com)

---

<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:** [July 21, 2012, 9:21pm UTC](https://discourse.chef.io/t/trouble-reloading-a-service/2941/4 "2012-07-21T21:21:29Z")

</div>

On Fri, Jul 20, 2012 at 4:23 PM, AJ Christensen [aj@junglist.gen.nz](mailto:aj@junglist.gen.nz) wrote:

> What platform? I think the Redhat service provider has supports  
> :status forced to 'true' always or something dumb like that.

Yep, see [http://tickets.opscode.com/browse/CHEF-2345](http://tickets.opscode.com/browse/CHEF-2345)

You must use the status\_command param to give it something that will  
work (i.e. 'pgrep foo') or else fix your init script. I think I have  
an idea of how to fix this but I haven't had time yet. Because of  
passing between resource and provider, the solution is a bit more  
complex than it first appears.

KC

---

<div class="post-metadata">

**Author:** ![Allan\_Wind](https://avatars.discourse-cdn.com/v4/letter/a/ac91a4/32.png) [@Allan\_Wind](https://discourse.chef.io/u/Allan_Wind)\
**Post date:** [July 21, 2012, 9:33pm UTC](https://discourse.chef.io/t/trouble-reloading-a-service/2941/5 "2012-07-21T21:33:47Z")

</div>

On 2012-07-21 14:21:29, KC Braunschweig wrote:

> On Fri, Jul 20, 2012 at 4:23 PM, AJ Christensen [aj@junglist.gen.nz](mailto:aj@junglist.gen.nz) wrote:
> 
> > What platform? I think the Redhat service provider has supports  
> > :status forced to 'true' always or something dumb like that.
> 
> Yep, see [http://tickets.opscode.com/browse/CHEF-2345](http://tickets.opscode.com/browse/CHEF-2345)

This explains why the chef ignores supports :status =\> false, but  
I am afraid that I do not follow why that would cause chef to not  
call reload on the init script.

## /Allan

Allan Wind  
Life Integrity, LLC  
[http://lifeintegrity.com](http://lifeintegrity.com)

---

<div class="post-metadata">

**Author:** ![AJ\_Christensen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aj_christensen/32/525_2.png) [@AJ\_Christensen](https://discourse.chef.io/u/AJ_Christensen)\
**Post date:** [July 21, 2012, 10:51pm UTC](https://discourse.chef.io/t/trouble-reloading-a-service/2941/6 "2012-07-21T22:51:14Z")

</div>

The reload\_service action more than likely has logic in it to prevent  
it from firing if the application isn't actually running.. soo, a bad  
status check =\> the service not running =\> service does not get  
reloaded

HTH

--AJ

On 22 July 2012 09:33, Allan Wind [allan\_wind@lifeintegrity.com](mailto:allan_wind@lifeintegrity.com) wrote:

> On 2012-07-21 14:21:29, KC Braunschweig wrote:
> 
> > On Fri, Jul 20, 2012 at 4:23 PM, AJ Christensen [aj@junglist.gen.nz](mailto:aj@junglist.gen.nz) wrote:
> > 
> > > What platform? I think the Redhat service provider has supports  
> > > :status forced to 'true' always or something dumb like that.
> > 
> > Yep, see [http://tickets.opscode.com/browse/CHEF-2345](http://tickets.opscode.com/browse/CHEF-2345)
> 
> This explains why the chef ignores supports :status =\> false, but  
> I am afraid that I do not follow why that would cause chef to not  
> call reload on the init script.
> 
> ## /Allan
> 
> Allan Wind  
> Life Integrity, LLC  
> [http://lifeintegrity.com](http://lifeintegrity.com)

---

<div class="post-metadata">

**Author:** ![Allan\_Wind](https://avatars.discourse-cdn.com/v4/letter/a/ac91a4/32.png) [@Allan\_Wind](https://discourse.chef.io/u/Allan_Wind)\
**Post date:** [July 21, 2012, 11:23pm UTC](https://discourse.chef.io/t/trouble-reloading-a-service/2941/7 "2012-07-21T23:23:29Z")

</div>

On 2012-07-22 10:51:14, AJ Christensen wrote:

> The reload\_service action more than likely has logic in it to prevent  
> it from firing if the application isn't actually running.. soo, a bad  
> status check =\> the service not running =\> service does not get  
> reloaded

You are right fixing the status resolved the issue. Thanks a lot  
for your help.

Recipe ask to reload a service. chef does no less than 3 status  
calls which all fail with 127 in this case. chef then decides  
that you reload does not make sense anyways. There are no logs  
indicating any problems.

chef does the same 3 status checks for restart but decides to  
restart the service anyways.

The inconsistency is strange to me, and the lack of log output  
is a defect, no?

## /Allan

Allan Wind  
Life Integrity, LLC  
[http://lifeintegrity.com](http://lifeintegrity.com)

---

<div class="post-metadata">

**Author:** ![AJ\_Christensen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aj_christensen/32/525_2.png) [@AJ\_Christensen](https://discourse.chef.io/u/AJ_Christensen)\
**Post date:** [July 22, 2012, 12:34am UTC](https://discourse.chef.io/t/trouble-reloading-a-service/2941/8 "2012-07-22T00:34:08Z")

</div>

It does appear that some logging is missing from your pastebin, yes.  
The service debug logging is _much_ more than that 😉 usually  
indicates, service supports status, running status. I'm not sure why  
you aren't seeing that.

Can you test the latest version of (pre-release?) Chef 10.14?

I'll do the same

--AJ

On 22 July 2012 11:23, Allan Wind [allan\_wind@lifeintegrity.com](mailto:allan_wind@lifeintegrity.com) wrote:

> On 2012-07-22 10:51:14, AJ Christensen wrote:
> 
> > The reload\_service action more than likely has logic in it to prevent  
> > it from firing if the application isn't actually running.. soo, a bad  
> > status check =\> the service not running =\> service does not get  
> > reloaded
> 
> You are right fixing the status resolved the issue. Thanks a lot  
> for your help.
> 
> Recipe ask to reload a service. chef does no less than 3 status  
> calls which all fail with 127 in this case. chef then decides  
> that you reload does not make sense anyways. There are no logs  
> indicating any problems.
> 
> chef does the same 3 status checks for restart but decides to  
> restart the service anyways.
> 
> The inconsistency is strange to me, and the lack of log output  
> is a defect, no?
> 
> ## /Allan
> 
> Allan Wind  
> Life Integrity, LLC  
> [http://lifeintegrity.com](http://lifeintegrity.com)

---

<div class="post-metadata">

**Author:** ![Allan\_Wind](https://avatars.discourse-cdn.com/v4/letter/a/ac91a4/32.png) [@Allan\_Wind](https://discourse.chef.io/u/Allan_Wind)\
**Post date:** [July 22, 2012, 1:22am UTC](https://discourse.chef.io/t/trouble-reloading-a-service/2941/9 "2012-07-22T01:22:20Z")

</div>

On 2012-07-22 12:34:08, AJ Christensen wrote:

> Can you test the latest version of (pre-release?) Chef 10.14?

I added status to my init script, forced an update of my config  
file to trigger reload (which now works):

[http://pastebin.com/2QnY6ShK](http://pastebin.com/2QnY6ShK)

Was there another scenario you would like me to test?

## /Allan

Allan Wind  
Life Integrity, LLC  
[http://lifeintegrity.com](http://lifeintegrity.com)
