在Rails环境中执行Ruby Worker脚本

时间:2022-03-05 12:05:24

I have the following case:

我有以下情况:

I want to be able to run an independent Ruby script as a daemon. I would like to be able to execute this script in the context/environment of my Rails project (so that the script can have access to the back-end/my Rails models, for example).

我希望能够作为守护程序运行独立的Ruby脚本。我希望能够在Rails项目的上下文中/环境中执行这个脚本(例如,这样脚本就可以访问后端/我的Rails模型)。

Is there a straightforward way to accomplish this?

有没有一种简单的方法来实现这个目标?

Thanks!

谢谢!

1 个解决方案

#1


4  

Use rails runner.

使用rails的跑步者。

You could also create a rake task.

您还可以创建rake任务。

#1


4  

Use rails runner.

使用rails的跑步者。

You could also create a rake task.

您还可以创建rake任务。