当前位置: 动力学知识库 > 问答 > 编程问答 >

ruby on rails - Running rake tasks via Iron Worker

问题描述:

I'm trying to run a rake task (rake db:send_pending_emails) every minute via Iron Worker, but I can't seem to get it to work... Maybe I don't understand the IronWorker API so well, but I'm doing something like this:

runtime "ruby"

gemfile "../Gemfile"

exec "send_emails.rb"

In "send_emails.rb" I have:

`rake db:send_pending_emails`

This is probably (very) wrong, so I'm wondering if someone could help me figure this one out?

Thanks!

网友答案:

it looks like you're missing a few things in your .worker file. You'd have to add your Rakefile and all required dependencies to your .worker file for it to be able to run on the IronWorker platform. It looks like you've included all your gem dependencies, but you'll also need to include your own code if it's required to run the rake task with the file and/or dir includes.

Also, it's probably easier to not use Rake and just copy what's in that task into your send_emails.rb.

分享给朋友:
您可能感兴趣的文章:
随机阅读: