我有一个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从命令行运行,则说明的rake任务(rake 'cron:deliver_email'
)正常运行:deliver_email
我已经使用not require语句添加了我的Gemfile(:require =&gt; 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.