Super Spread Sheet S³

Or little computing tricks and hacks

Rails server and X-server crash

While running a Rails server, my X server crashed leaving all the files intact, ports locked and a phantom server running. Which meant that I could not run the server and the message was:

$ rails server
=> 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
A server is already running. Check …/tmp/pids/server.pid.
Exiting

I first tried to delete the file
/tmp/pids/server.pid but that was not enough. Of course. I did not realize that the actual server was still running. Two command to find out:

  • lsof | grep 3000
    which should give something like
    ruby 5586 mancilla 8u IPv4 32461381 0t0 TCP *:3000 (LISTEN)
  • ps aux | grep rails
    which should give
    mancilla 5586 0.0 1.2 695204 100296 ? Sl Oct28 1:31 .../rails server

The solution is simple: simply kill the concern process, is this case 5586 as follows:
kill -9 5586

And just as a matter of information, if you want to run a second server just run the following:
rails s -p 3001 -P tmp/pids/server2.pid

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: