running windows service in ruby on windows 7

落爺英雄遲暮 提交于 2019-12-12 03:54:35

问题


I am using this gem: win32-service (0.7.2 x86-mingw32)

The gem has a demo_daemon.rb and a demo_daemon_ctl.rb in the example directory. I have tried to run the example as a service using both ruby 1.8.7 and 1.9.3 and I get the error below. The daemon tries to write to a log file, but it never reaches a point where the log file gets written. Even if I put a log write on startup of the script nothing gets written.

My machine is 64 bit.

Any ideas on what I can try or what could be the issue?

C:/Ruby193/lib/ruby/gems/1.9.1/gems/win32-service-0.7.2-x86-mingw32/lib/win32/se
rvice.rb:760:in `start': The service did not respond to the start or control req
uest in a timely fashion. (Win32::Service::Error)
        from demo_daemon_ctl.rb:75:in `<main>'

回答1:


I think you need use a service wrapper such as srvany . Here is the Microsoft's guide. Use full path for both ruby and the script in the "Application" parameter. And if something goes wrong under 64bit system, just put the srvany.exe in both windows/system32 and windows/sysWow64 folder.



来源:https://stackoverflow.com/questions/15394683/running-windows-service-in-ruby-on-windows-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!