Ruby on Rails 4每当cron工作不起作用

 yueloong 发布于 2023-02-08 13:59

我想使用Whenever gem在我的RoR应用程序中运行预定作业.我运行bundle install,这是我的schedule.rb:

every 1.minute do
   runner "Event.executeEvents"
end

我的Event.executeEvents方法是一个简单的日志条目:

class Event < ActiveRecord::Base

  def executeEvents
    puts "executeEvents at [" + Time.now.inspect + "]"
  end
end

如果我whenever在命令行执行,我得到了这个:

$ whenever                       
* * * * * /bin/bash -l -c 'cd C:/dev/yanpyapi && bin/rails runner -e production '\''Event.executeEvents'\'''

## [message] Above is your schedule file converted to cron syntax; your crontab file was not updated.
## [message] Run `whenever --help' for more options.

什么都没有执行.

我错过了什么?

我需要以某种方式启动它吗?我读过一些关于capistrano和RVM的文档,但我不知道这是什么...

1 个回答
  • 你必须执行

    whenever -i
    

    将作业添加到crontab

    2023-02-08 14:05 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有