在Rails3应用程序中运行rufus-scheduler没有任何问题。
但由于我的应用程序是在节点集群app1.myapp.com - app2.myapp.com中运行的,所以rufus-scheduler会运行作业应用程序(N)次。
如何让它只在一台服务器上运行?
发布于 2011-09-09 04:48:37
你有没有想过这个天真的解决方案:
# at initialization
if `hostname -f` == 'app1.myapp.com'
$scheduler = Rufus::Scheduler.start_new
$scheduler.every '5s' do
puts "hello world"
end
else
# we're on another host, do not schedule anything
$scheduler = nil
endhttps://stackoverflow.com/questions/7352328
复制相似问题