Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想安排一个 cron 作业在太平洋标准时间上午 5 点到晚上 8 点运行?我只想知道如何强制我的工作在 PST 上运行?我是这个 cron Job 的新手。
// 代码
cron: "0 5-20 * * *"
您可以通过以下方式将时区指定给 cron。
"0 5-20 * * * America/Los_Angeles"
如果您不确定它会出现哪个时区,只需使用此命令获取 rails 的时区记录ActiveSupport::TimeZone.all并选择TZInfo::DataTimezone。
ActiveSupport::TimeZone.all
TZInfo::DataTimezone