简体   繁体   English

启动Rails应用程序时如何启动ruby服务器脚本?

[英]How can I start up a ruby server script when I start up my rails app?

I'd like for a ruby server script that lives in my rails app root folder to accept connections from clients (the clients are not browsers--not that this really matters i guess) and update the db of my rails app while my rails app is running. 我想要一个驻留在我的rails应用程序根文件夹中的ruby服务器脚本,以接受来自客户端的连接(客户端不是浏览器,我猜这不是很重要),并在我的rails应用程序时更新Rails应用程序的数据库在跑。 Therefore, I'd like for it to be told somehow to start running whenever my web server starts serving up my rails app and stop running whenever my web server stops serving my rails app. 因此,我希望有人告诉它无论何时我的Web服务器开始为Rails应用提供服务时都开始运行,并在我的Web服务器停止为Rails应用提供服务时停止运行。 How can I do this? 我怎样才能做到这一点? Is this as simple as putting the name/path of my ruby server script somewhere? 这就像将我的ruby服务器脚本的名称/路径放在某处一样简单吗?

您应该查看Foreman ,它是专门用于在服务器环境中启动多个进程的宝石。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM