在Whenever gem中,如果我们使用every :month,它是指月底还是月初?
In Whenever gem, if we use every :month, does it mean the end of month or beginning?
使用 whenever
gem 时,我们可以像这样设置月度工作:
every :month do
...
end
这个运行是月末还是月初的工作?我想运行它在最后。
assert_equal '0 0 1 * *', parse_time(:month)
因此 :month
将生成一个看起来像 0 0 1 * *..
的 cron 条目
对应run once a month at midnight of the first day of the month.
完成 运行 月最后一天的一种方法是在以下任意位置使用原始 cron 条目:
every '0 0 L * *' do
...
end
这假定服务器上的 cron 支持 L
标志来表示该月的最后一天。
有关 运行 在每月最后一天执行 cron 作业的更多信息,请参阅 Cron job to run on the last day of the month。
使用 whenever
gem 时,我们可以像这样设置月度工作:
every :month do
...
end
这个运行是月末还是月初的工作?我想运行它在最后。
assert_equal '0 0 1 * *', parse_time(:month)
因此 :month
将生成一个看起来像 0 0 1 * *..
对应run once a month at midnight of the first day of the month.
完成 运行 月最后一天的一种方法是在以下任意位置使用原始 cron 条目:
every '0 0 L * *' do
...
end
这假定服务器上的 cron 支持 L
标志来表示该月的最后一天。
有关 运行 在每月最后一天执行 cron 作业的更多信息,请参阅 Cron job to run on the last day of the month。