Restart Nginx service on Centos 7 via chef

我正在尝试使用chef配置nginx服务,但是我得到下面的错误。

Chef::Exceptions::Service
-------------------------
service[nginx]: unable to locate the init.d script!


Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/xxx/recipes/default.rb

 23: service 'nginx' do
 24:   supports :status => true, :restart => true, :reload => true
 25:   action   :enable
 26: end
 27:     

To copy this down to an answer:

That would do it, that predates the automatic systemd support. I don't remember if we even included systemd support at all back then. Probably best to upgrade to at least the latest 11.x release, though really you should move to 12 by now

You can try adding provider Chef::Provider::Service::Systemd to your service resource and see if that works. If it doesn't, then you'll need to upgrade.

链接地址: http://www.djcxy.com/p/78314.html

上一篇: 厨师:延迟服务通知

下一篇: 通过厨师在Centos 7上重新启动Nginx服务