# How to restart runit service if template changes

**URL:** <https://discourse.chef.io/t/how-to-restart-runit-service-if-template-changes/3716>\
**Category:** Chef Infra (archive)\
**Created:** [March 8, 2013, 10:00am UTC](https://discourse.chef.io/t/how-to-restart-runit-service-if-template-changes/3716 "2013-03-08T10:00:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Montgomery](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@David\_Montgomery](https://discourse.chef.io/u/David_Montgomery)\
**Post date:** [March 8, 2013, 10:00am UTC](https://discourse.chef.io/t/how-to-restart-runit-service-if-template-changes/3716/1 "2013-03-08T10:00:23Z")

</div>

Hi,

I am using the runit cookbook. Below is how I assume a restart of runit  
should look like but from the docs it apears that service is not supported  
for runit. How do I accomplish the below?

template “/home/ubuntu/druid/batch.json” do  
path "/home/ubuntu/druid/batch.json"  
source "batch.json.erb"  
owner "root"  
group “root"  
mode “0644"  
variables({  
:s3bucket =\> “#{s3bucket}”,:mysql\_host =\> “#{mysql\_host}”,  
:mysql\_username =\> “#{mysql\_username}”, :mysql\_password =\>  
”#{mysql\_password}”  
})  
notifies :restart, resources(:service =\> “Batch”)  
end

service “Batch” do  
supports :restart =\> true, :start =\> true, :stop =\> true  
action :enable  
end

runit\_service “Batch”

---

<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:** [March 8, 2013, 10:28am UTC](https://discourse.chef.io/t/how-to-restart-runit-service-if-template-changes/3716/2 "2013-03-08T10:28:54Z")

</div>

You appear to have an extra 'service' definition for Block.

You only need the runit\_service.; probably better to use the modern  
notifies syntax too:

notifies :restart, "service[Batch]"

Please post the full debug logs relevant to any error you've received.

Cheers,

AJ

On 8 March 2013 23:00, David Montgomery [davidmontgomery@gmail.com](mailto:davidmontgomery@gmail.com) wrote:

> Hi,
> 
> I am using the runit cookbook. Below is how I assume a restart of runit  
> should look like but from the docs it apears that service is not supported  
> for runit. How do I accomplish the below?
> 
> template "/home/ubuntu/druid/batch.json" do  
> path "/home/ubuntu/druid/batch.json"  
> source "batch.json.erb"  
> owner "root"  
> group "root"  
> mode "0644"  
> variables({  
> :s3bucket =\> "#{s3bucket}",:mysql\_host =\> "#{mysql\_host}",  
> :mysql\_username =\> "#{mysql\_username}", :mysql\_password =\>  
> "#{mysql\_password}"  
> })  
> notifies :restart, resources(:service =\> "Batch")  
> end
> 
> service "Batch" do  
> supports :restart =\> true, :start =\> true, :stop =\> true  
> action :enable  
> end
> 
> runit\_service "Batch"
