【问题标题】:Can't stop or view rails server无法停止或查看 rails 服务器
【发布时间】:2014-04-08 13:44:04
【问题描述】:

当我关闭运行 Rails 服务器的终端窗口时,服务器会继续在后台运行。我无法重新打开 Rails 服务器并关闭它。即使退出终端应用程序也不够,我必须完全重新启动计算机才能停止 rails 服务器。

有没有更好的方法?

谢谢

【问题讨论】:

    标签: ruby-on-rails debian webrick google-chrome-os


    【解决方案1】:

    您应该使用 ctrl+c 终止服务器,以停止服务器。

      If not use this command to kill the port on which the your app is running,
    
       fuser -n tcp -k (port number)
    

    【讨论】:

      【解决方案2】:

      按 ctrl-c 是停止服务器的正确方法

      => Booting WEBrick
      => Rails 4.0.0 application starting in development on http://0.0.0.0:3000
      => Run `rails server -h` for more startup options
      => Ctrl-C to shutdown server
      [2014-04-08 21:14:42] INFO  WEBrick 1.3.1
      [2014-04-08 21:14:42] INFO  ruby 2.0.0 (2013-11-22) [x86_64-linux]
      [2014-04-08 21:14:42] INFO  WEBrick::HTTPServer#start: pid=2677 port=3000
      

      如果您不小心关闭了终端,您可以在 tmp/pid 中检查进程 ID 然后执行

      kill 8976
      

      其中 8976 是终止进程的 pid。然后你应该能够再次运行你的服务器。

      编码愉快:D

      【讨论】:

        【解决方案3】:
        ps aux | grep rails
        

        查看您的 Rails 服务器的 pid 号,然后运行此命令

        kill -9 pid
        

        【讨论】:

          【解决方案4】:

          如果您使用的是 windows,您可以删除应用程序文件/tmp/pids 上的服务器 PID 文件,它会终止服务器。为避免必须这样做,请尝试多次按 CTRL+c,直到 CMD 显示服务器进程已终止。

          【讨论】:

            猜你喜欢
            • 2013-02-11
            • 1970-01-01
            • 1970-01-01
            • 2019-01-04
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2019-06-27
            相关资源
            最近更新 更多