Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails RubyonRails crontab任务已计划但未运行_Ruby On Rails_Rake Task_Whenever - Fatal编程技术网

Ruby on rails RubyonRails crontab任务已计划但未运行

Ruby on rails RubyonRails crontab任务已计划但未运行,ruby-on-rails,rake-task,whenever,Ruby On Rails,Rake Task,Whenever,我正在使用Everyone gem创建rake任务,我希望每2分钟在我的终端上获得一行输出“Teaching Thabo how schedule tasks”,我是Rails新手,下面是我命名为request_invoice.rake的rake任务文件的代码 namespace :request_invoice do desc "Teaching Thabo how to schedule tasks" task test_tasking: :environment do put

我正在使用Everyone gem创建rake任务,我希望每2分钟在我的终端上获得一行输出“Teaching Thabo how schedule tasks”,我是Rails新手,下面是我命名为request_invoice.rake的rake任务文件的代码

 namespace :request_invoice do
  desc "Teaching Thabo how to schedule tasks"
  task test_tasking: :environment do
  puts "Learning the tasking in rails..."
  end
 end
每当gem在我的项目的配置中创建schedule.rb文件时,我在该文件中有以下代码

 every 2.minutes do
 rake 'request_invoice:test_tasking'
 end
我在终端上运行了where命令,它给出了以下内容:

    0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,5 2,54,56,58 /bin/bash -l -c 'cd /home/sable/GMS/grading-     management-solution && RAILS_ENV=production bundle exec rake    request_invoice:test_tasking --silent'
## [message] Above is your schedule file converted to cron syntax; your crontab file was not updated.
## [message] Run `whenever --help' for more options.
您是否运行了:

whenever --update-crontab
指挥部?根据,这是更新crontab文件所必需的。

是否运行了:

whenever --update-crontab

指挥部?根据,这是更新crontab文件所必需的。

首先,您需要检查是否已将任务添加到
crontab
,或者未使用:

crontab -e
如果看不到任务,请使用以下方法添加:

whenever -i
您可以通过设置日志文件来跟踪cron作业。只需将以下内容添加到
config/schedule.rb
的顶部即可:

set :output, "log/cron_log.log"
现在,您应该能够检查cron日志(如果
tail
对您可用,那么从应用程序路径的根目录执行以下操作):


首先,您需要检查是否已将任务添加到
crontab
或未使用:

crontab -e
如果看不到任务,请使用以下方法添加:

whenever -i
您可以通过设置日志文件来跟踪cron作业。只需将以下内容添加到
config/schedule.rb
的顶部即可:

set :output, "log/cron_log.log"
现在,您应该能够检查cron日志(如果
tail
对您可用,那么从应用程序路径的根目录执行以下操作):


是的,我确实运行了where--update crontab它返回了这个:[write]crontab文件updated是的,我确实运行了where--update crontab它返回了这个:[write]crontab文件updated我可以看到任务,我甚至可以直接使用rake运行它时得到输出,像rake request\u envoice:test\u tasking您是否键入了
crontab-e
,您能显示结果吗?它打开了nano,在生成任务时开始:/home/sable/GMS/grading management solution/config/schedule.rb0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58****/bin/b$#每当为:/home/sable/GMS/grading management solution/config/schedule.rbNo生成任务时,只要开头有上述文本的空白nano看起来正确,请检查您的cron日志。参考:我可以看到任务,甚至当我使用rake直接运行它时,我会得到输出,比如rake request\u envoice:test\u tasking您是否键入了
crontab-e
,您能显示结果吗?它打开了nano,在生成任务时开始:/home/sable/GMS/grading management solution/config/schedule.rb0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58****/bin/b$#每当为:/home/sable/GMS/grading management solution/config/schedule.rbNo生成任务时,只要开头有上述文本的空白nano看起来正确,请检查您的cron日志。参考: