正在做Hart的Rails教程,但是服务器不会为我关闭,而是在更新后启动它 [英] Doing Hart's Rails Tutorial, but server won't shut down for me fire it up after updates

查看:234
本文介绍了正在做Hart的Rails教程,但是服务器不会为我关闭,而是在更新后启动它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对各种文件进行了一些更改,需要关闭然后重新启动服务器才能查看它们。我正在使用Cloud9导航环境。但是我一直收到相同的错误-服务器已在运行。请参阅以下内容:

I have made some changes to various files, and need to shut down and then restart the server to see them. I am using the Cloud9 railstutorial environment. But I keep getting the same error - "A server is already running". Please see below:

darrenbrett:~/workspace/sample_app (filling-in-layout) $ rails server -b $IP -p $PORT
=> Booting WEBrick
=> Rails 4.2.2 application starting in development on http://0.0.0.0:8080
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server

A server is already running. Check /home/ubuntu/workspace/sample_app/tmp/pids/server.pid.
Exiting
darrenbrett:~/workspace/sample_app (filling-in-layout) $ 


推荐答案

首先找出进程ID( PID ):

Find out the process id (PID) first:

$ lsof -wni tcp:8080

这会给你像这样的东西:

This will give you something like this:

$ lsof -wni tcp:8080 

COMMAND   PID   USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
ruby    59656 rislam   14u  IPv6 0xa86b8563672ef037      0t0  TCP [::1]:http-alt (LISTEN)

然后,使用 PID = 59656终止进程(例如,对于您来说情况会有所不同)

$ kill -9 59656

此应该可以解决您的问题。

This should solve your problem.

您还可以使用以下命令杀死所有正在运行的应用程序,这些应用程序中有 rails 名称:

You can also use the following command to kill all running apps that has rails in the name:

killall -9 rails

有时候,这非常当第一个命令不起作用时有效。

Sometimes, this is very effective when the first command does not do the trick.

这篇关于正在做Hart的Rails教程,但是服务器不会为我关闭,而是在更新后启动它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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