Rails 每当 gem:每月 20 日 [英] Rails whenever gem: each month on the 20th

查看:33
本文介绍了Rails 每当 gem:每月 20 日的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在整个互联网上搜索了这个,文档并没有真正具体讨论每月的工作.所以我希望这里有人能告诉我如何做到这一点.

I searched all over the internet for this, and the documentation isn't really talking about monthly jobs in specific. So I was hoping that someone here could tell me how to do this.

我已经安装了every gem,我需要知道的是正确的语法:

I've installed the whenever gem and all I need to know is the right syntax for this:

every :month, :on => '20th', :at => '02:00' do
  runner "Mailer.send_friend_sheet"
end

希望有人能指出我正确的方向..

Hope someone can point me in the right direction..

谢谢!

推荐答案

据我所知,只要不支持 :on 选项,但你应该能够做到

Whenever doesn't support an :on option as far as I am aware, but you should be able to do

every '0 2 20 * *' do
  runner "Mailer.send_friend_sheet"
end

'0 2 20 * *' 只是相关的 cron 语法 - 参见 http://www.manpagez.com/man/5/crontab/

The '0 2 20 * *' is simply the relevant cron syntax - see http://www.manpagez.com/man/5/crontab/

这篇关于Rails 每当 gem:每月 20 日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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