简体   繁体   English

作为Windows服务运行delay_job

[英]Running delayed_job as a windows service

I am trying to get delayed_job working as a windows service. 我正在尝试让delay_job作为Windows服务工作。

I am so thoroughly sick of windows I can't even begin to put it into words, but I am stuck with it for now due to 3rd party dependencies. 我对Windows感到非常厌倦,甚至无法开始将它写成文字,但是由于第三方的依赖性,我暂时仍然坚持使用它。

Running rake jobs:work starts the worker in a console with no problems. 运行rake jobs:work可以在控制台中rake jobs:work启动工作程序。

I've created an empty windows service to start and shutdown the worker using sc create DelayedJobWorker... . 我使用sc create DelayedJobWorker...创建了一个空的Windows服务来启动和关闭工作sc create DelayedJobWorker...

However, I can't get the service to start and stop the worker. 但是,我无法获得启动和停止工作程序的服务。 I'm not sure what the best approach is - what I should be parameterising the service with / asking it to call. 我不确定最好的方法是什么-我应该使用/要求调用该服务来参数化什么。

Any suggestions gratefully appreciated. 任何建议表示感谢。

I did this by: 我这样做是:

  1. Copying srvany.exe from the Windows Resource Kit to C:\\windows\\system32 . 将srvany.exe从Windows资源工具包复制到C:\\windows\\system32

  2. Creating an empty service using sc create JobQueue binPath= "C:\\windows\\system32" 使用sc create JobQueue binPath= "C:\\windows\\system32"空服务, sc create JobQueue binPath= "C:\\windows\\system32"

  3. Adding a registry key called Parameters to the service registry key located at HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > services > JobQueue 将名为Parameters的注册表项添加到位于HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > services > JobQueue的服务注册表项中

  4. Adding the following three string values to the new registry key. 将以下三个字符串值添加到新的注册表项。

As below: 如下:

Application="c:\ruby193\bin\ruby.exe"
AppDirectory="$PATH_TO_RAILS_APP"
AppParameters="c:\ruby193\bin\rake jobs:work RAILS_ENV=$ENVIRONMENT"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM