Service doesn't start when using chef
6,234
Most probably you have some errors in your /etc/init.d/myservice
script. When you say that yourservice supports status
command, chef will run service myservice status
and check the exitcode. If it's 0, it assumes that the service is running. Your script should exit with nonzero code.
Related videos on Youtube
Comments
-
Jay over 1 year
I've written a script which I trigger as a service. When I call
service myservice start
the service starts fine. However, when the same service is triggered using chef, the service doesnt start. My chef service code looks like thisservice "myservice" do supports :status => true, :restart => true, :reload => true action [ :enable, :start ] end
I call the script using
knife bootstrap <ip> -r 'recipe[testservice]'
. What am I missing here? Thanks for the help!-
Oin about 11 yearsCould you say what platform you are running this on? And what chef version? The service provider might have something to do with it.
-
Jay about 11 yearsI use a Centos box. The chef version is 11.4.0.
-
Oin about 11 yearsIn the output from knife bootstrap do you see a line with: INFO: service[myservice] restarted ?
-
Jay about 11 yearsI see this
service[myservice] action start 172.16.13.251 (up to date)
-
Jay about 11 yearsfor some reason chef thinks my service is running when its not.
-