Wednesday, January 29, 2014

Rails: A server is already running. Check /vagrant/tmp/pids/server.pid

I'm using vagrant as my virtual machine for a project and kept running into my port not shutting down completely after exiting the rails server.

vagrant@precise32:/vagrant$ rails s
=> Booting Thin
=> Rails 3.2.16 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
A server is already running. Check /vagrant/tmp/pids/server.pid

Solution was to check the port and to kill the process with the pid:

$ lsof -wni tcp:3000
COMMAND   PID    USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
ruby    12365 vagrant    9u  IPv4 114859      0t0  TCP *:3000 (LISTEN)
kill -9 12365

No comments:

Post a Comment