Rufus调度程序未运行 [英] Rufus Scheduler not running

查看:111
本文介绍了Rufus调度程序未运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用gem rufus-scheduler执行简单操作:
https:// github .com / jmettraux / rufus-scheduler

I want to do something simple with the gem rufus-scheduler: https://github.com/jmettraux/rufus-scheduler

但我无法使其正常工作。

but, i can't get it to work.

我有一个常规的轨道应用程序。我创建了一个.rb文件:

I have a regular rails app. I created a .rb file:

# test_rufus_scheduler.rb
require 'rubygems'
require 'rufus/scheduler'

scheduler = Rufus::Scheduler.start_new

scheduler.in '1s' do
  puts "hello world"
end

然后,当我尝试ruby test_rufus_scheduler.rb时,没有任何反应。我做的对吗? gem列表显示rufus-scheduler。

Then, when I try ruby test_rufus_scheduler.rb, nothing happens. Am i doing it right? gem list shows rufus-scheduler.

谢谢。

推荐答案

您的脚本立即退出,请尝试添加

If your script exits right away please try to add

scheduler.join

结尾。请注意,当运行脚本独立和通过rails时它是不同的。有关详细信息,请参阅自述文件

at the end. Please note that it's different when running the script stand alone and via rails. See the README for detailled information.

这篇关于Rufus调度程序未运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆