2013-06-27 27 views
1

我正在嘗試關注紅寶石中的AppFog guide on creating a background worker,我遇到了一些(可能是noob)問題。該示例使用Rufus-scheduler,其中(根據the Ruby docs on AppFog)意味着我需要使用在我的應用程序中包含/管理。儘管如此,我運行了bundle install,以適當的('獨立')方式將所有內容推送到AppFog,並且仍然無法使其運行。AppFog後臺工作'未能啓動'

我的應用程序&的Gemfile: enter image description here

...並通過AF CLI:

$ af push 
[...creating/uploading/etc. etc... - removed to save space] 
Staging Application 'chservice-dev': OK           
Starting Application 'chservice-dev': . 

Error: Application [chservice-dev] failed to start, logs information below. 

====> /logs/staging.log <==== 

# Logfile created on 2013-06-27 20:22:23 +0000 by logger.rb/25413 
Need to fetch tzinfo-1.0.1.gem from RubyGems 
Adding tzinfo-1.0.1.gem to app... 
Adding rufus-scheduler-2.0.19.gem to app... 
Adding bundler-1.1.3.gem to app... 

====> /logs/stdout.log <==== 

2013-06-27 20:22:28.841 - script executed. 

Delete the application? [Yn]: 

如何解決(或解決)呢?我可能錯過了一大步/概念...非常新的紅寶石=)

在此先感謝。

回答

2

我認爲應用程序可能會立即退出。調度程序需要連接到主線程才能使該應用程序繼續運行。

require 'rubygems' 
require 'rufus/scheduler' 

scheduler = Rufus::Scheduler.start_new 

scheduler.every '10s' do 
    puts 'Log this' 
end 

### join the scheduler to the main thread ### 
scheduler.join 

我創建了一個樣本魯弗斯調度的應用程序,在appfog工作:https://github.com/tsantef/appfog-rufus-example