服务器已在运行。检查C:/Rails/tmp/pids/server.pid

时间:2013-05-11 06:54:17

标签: ruby-on-rails ruby

每当我在不同的端口上运行2个rails服务器时,请说3000和3001.

在端口3000上启动服务器后

Rails$ rails s -p 3000 
=> Booting Mongrel
=> Rails 3.1.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server

当我在端口3001上运行第二个rails服务器时,

Rails$ rails s -p 3001
=> Booting Mongrel
=> Rails 3.1.1 application starting in development on http://0.0.0.0:3001
=> Call with -d to detach
=> Ctrl-C to shutdown server
A server is already running. Check /Rails/tmp/pids/server.pid.
Exiting

在我能够在端口3001上启动rails服务器之前,我需要删除server.pid文件。 有没有办法每次都避免删除文件?

1 个答案:

答案 0 :(得分:16)

开始连续的申请,例如:

rails s -p 3001 -P tmp/pids/server_2.pid

信用:https://stackoverflow.com/a/14446920/1376448