当我运行ruby时script/server -e test,它在控制台上运行.当我关闭控制台时,它也会停止该过程.我想在后台运行服务器.我怎样才能做到这一点?
Kry*_*man 21
如果你使用thin:
rails server thin -d
并且,为了阻止它:
kill -9 $(cat tmp/pids/server.pid)
ian*_*its 12
回答有点晚了.但这对未来的人有好处.
假设它拥有Unix/Linux操作系统,最简单快捷的方式将rails(或任何服务在后台)放入
$ nohup rails server &
这可以用于任何这样的服务
$ nohup <service command> &
&最后运行你的服务器:
script/server -e test&
Run Code Online (Sandbox Code Playgroud)
它将把它置于后台。
或者您可以使用其他服务器,例如 Thin: http: //code.macournoyer.com/thin/
(sudo) gem install thin
Run Code Online (Sandbox Code Playgroud)
然后使用启动和停止它
thin start
thin stop
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
26645 次 |
| 最近记录: |