title: chef won't start my init.d service
body: <p>I'm creating a service via this <a href="https://docs.mongodb.com/manual/tutorial/transparent-huge-pages/" rel="nofollow noreferrer">mongo doc</a>.</p>
  
  <p>I have this in my recipe to install the service via a template:</p>
  
  <pre><code>service 'disable-transparent-hugepages' do
    supports :restart =&gt; true, :start =&gt; true, :stop =&gt; true, :reload =&gt; true
    action :nothing
  end
  
  template 'disable-transparent-hugepages' do
    path '/etc/init.d/disable-transparent-hugepages'
    source 'disable-transparent-hugepages.erb'
    owner 'root'
    group 'root'
    mode '0755'
    notifies :enable, 'service[disable-transparent-hugepages]'
    notifies :start, 'service[disable-transparent-hugepages]'
  end
  </code></pre>
  
  <p>When I run the recipe multiple times it pulls the init.d script to the right location, but if I check the status of it I see this:
  <a href="https://i.stack.imgur.com/xODwi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xODwi.png" alt="enter image description here"></a></p>
  
  <p>After I confirmed its installed I added a line in the recipe to just start the service like normal:</p>
  
  <pre><code>service 'disable-transparent-hugepages' do
    action :start
  end
  </code></pre>
  
  <p>But still it isn't started.</p>
  
  <p>If I manually start it I can see it working:
  <a href="https://i.stack.imgur.com/soEWv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/soEWv.png" alt="enter image description here"></a></p>
  
  <p>Why isn't chef starting the service?</p>
  
  <p>Edit: Ok so I found <a href="https://serverfault.com/questions/495969/service-doesnt-start-when-using-chef">this SO question</a> that says my problem might be that I need the init.d script (found in the link to the mongo doc) needs to exit with a non 0 return code. I am unsure though how to have the script return a non zero code when checking the status.</p>