在为我的 Rails 应用程序运行 Faye 服务器之前检查它是否存在 [英] Checking if the Faye server exists before running it for my Rails app

查看:38
本文介绍了在为我的 Rails 应用程序运行 Faye 服务器之前检查它是否存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于我在此处找到的先前问题:

In relation to a previous question of mine found here:

当我启动 Rails 时自动运行 Faye 服务器服务器

我现在每次启动 Rails 时都在运行 Faye 服务器.但是,这意味着当我运行 Rails 服务器、Rails 控制台或任何其他与 Rails 相关的东西时,它正在尝试运行 Faye 服务器.

I am now running the Faye server whenever I start Rails. However, this means it is trying to run the Faye server when I run the Rails server, the Rails console, or anything else Rails related.

有没有办法检查 Faye 服务器是否已经在运行?如果是,不尝试运行一个新的?或者这可能不是最好的方法,我欢迎所有想法和提示.

Is there a way to check if the Faye server is already running? And if it is, not attempt to run a new one? Or maybe this isn't the best approach, I welcome all ideas and tips.

推荐答案

您可以使用 DaemonController 库.它将使您能够使用 Rails 应用自动启动服务,如果它们尚未启动,则启动它们.

You can use the DaemonController library. It will enable you to auto-start services with your Rails app, starting them if they aren't already started.

这篇关于在为我的 Rails 应用程序运行 Faye 服务器之前检查它是否存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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