简体   繁体   中英

Running delayed_job as a windows service

I am trying to get delayed_job working as a windows service.

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.

Running rake jobs:work starts the worker in a console with no problems.

I've created an empty windows service to start and shutdown the worker using 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 .

  2. Creating an empty service using 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

  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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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