如何在Rails项目中运行日常任务/脚本? [英] How to run daily tasks/scripts in a Rails project?

查看:185
本文介绍了如何在Rails项目中运行日常任务/脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用我的应用程式的帐单系统,但我不知道如何设定每日执行的指令码,一个是传送付款提醒(电子邮件),另一个是降级

I'm working on the billing system for my app, but I'm not sure how to go about setting up scripts that run daily, one to send out payment reminders (email), and another to downgrade subscriptions that have not been renewed.


  • 有关如何执行此操作的任何提示吗?

  • 我需要观看的任何问题

我可以使用任何宝石完成了大部分的采购方,所以我不是寻找像paypal_recurring或条纹的宝石 - 只需要处理付款提醒和处理已过期的帐户。

I've completed most of the purchasing side already, so am not looking for gems like paypal_recurring, or stripe - just need to handle the payment reminders and dealing of accounts that have expired.

推荐答案

我做了这么多方式,有一堆方法来做。我认为目前的最佳做法是使用 Resque 将作业排队,

I've done this a number of ways and there are a bunch of ways to do it. I think the current best practice is to use Resque to queue the jobs and Rescue Scheduler to schedule them.

Resque是一个稳定的作业调度应用程序,可以处理各种任务。 Resque Scheduler可以提供完整的cron表达式(除了调度任务的其他方法之外)来管理作业。

Resque is a solid 'job scheduling' app that can handle all kinds of tasks for you. Resque Scheduler can be fed full cron expressions (in addition to other methods of scheduling tasks) to manage the jobs.

这种方法的一个优点是, Resque Web 应用程序,为您提供用于监控作业的网络应用程序(或者为一次性作业运行启动它们) 。

One of the advantages of this approach is that you get the Resque Web app that gives you a web app to use for monitoring the jobs (or launching them for one-off job runs).

我使用这种方法与Heroku,它工作得很好,是可靠的。

I've used this approach with Heroku and it works well and has been reliable.

这篇关于如何在Rails项目中运行日常任务/脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆