【发布时间】:2016-04-11 05:45:46
【问题描述】:
我有一个用于向系统中的用户发送电子邮件的 cron 作业,但它不想运行。我在日志中收到以下错误消息:
rake aborted!
Don't know how to build task 'cron:deliver_email'
/Users/ghost/.rvm/gems/ruby-2.2.1@maalify/bin/ruby_executable_hooks:15:in `eval'
/Users/ghost/.rvm/gems/ruby-2.2.1@maalify/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)
我的 schedule.rb 是这样的
set :environment, "development"
set :whenever_command, "bundle exec whenever"
set :output, {:error => "log/cron_error_log.log", :standard => "log/cron_log.log"}
every 1.minute do
command "gem install rake"
rake 'cron:deliver_email'
end
如果我使用 rake cron:deliver_email 从命令行执行,则所述 rake 任务 (rake 'cron:deliver_email') 运行正常
我已经在我的 Gemfile 中添加了 not require 语句 (:require => false)。
这就是我的 cron 工作的样子
▶ whenever
* * * * * /bin/bash -l -c 'gem install rake >> log/cron_log.log 2>> log/cron_error_log.log'
* * * * * /bin/bash -l -c 'cd /Users/ghost/code/IdeaProjects/maalify && RAILS_ENV=development bundle exec rake cron:deliver_email --silent >> log/cron_log.log 2>> log/cron_error_log.log'
## [message] Above is your schedule file converted to cron syntax; your crontab file was not updated.
## [message] Run `whenever --help' for more options.
【问题讨论】:
标签: ruby-on-rails ruby bash cron whenever