我有一个服务资源,但我无法让厨师启动它,而厨师只是吐出错误信息:
SystemCallError: The specified service does not exist as an installed service. - OpenService: The specified service does not exist as an installed service.
我不知道该怎么做才能解决这个问题,但我无法找到任何关于此错误的信息(可能是我没找对错的地方)。
该服务作为已安装的gem分发。
该服务本身是一个Sinatra应用程序,它使用win32-service
gem将其作为服务启动
该平台是Windows服务器(我知道,但我别无选择,我必须使用Windows服务器)
此服务的厨师食谱中的代码是:
service service_name do
init_command ("#{%x(gem env gemdir).strip.gsub('/','\\')}\\gems\\#{service_name}-#{installing_version}")
start_command "rake service:start"
stop_command "rake service:stop"
reload_command "rake service:reload"
restart_command "rake service:restart"
supports start: true, restart: true, reload: true
action [:enable,:start]
end
答案 0 :(得分:1)
问题不在于Chef,而在于您的服务本身。通常情况下,在这种情况下,我将手动登录并尝试启动该服务。有时,这将为您提供更多信息。另外,请查看您应用的日志文件,看看您是否可以找出它未启动的原因。
最终,Chef只会调用你的init并启动命令,但如果这些命令失败,它就无法做很多事情。