Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sinatra stopped with ctrl z -- now it won't restart because it says port 4567 is already being used

Tags:

ruby

sinatra

While running Sinatra, I accidentally hit ctrl+z to stop the server instead of ctrl+c Ctr+z seem to stop the application. But now I can't restart it. Please help.

   ^Z
[1]+  Stopped                 ruby app.rb
jeffrey-mac:scta JCWitt$ ruby app.rb 
[2014-01-23 11:34:24] INFO  WEBrick 1.3.1
[2014-01-23 11:34:24] INFO  ruby 1.9.3 (2012-04-20) [x86_64-darwin11.4.2]
[2014-01-23 11:34:24] WARN  TCPServer Error: Address already in use - bind(2)
[2014-01-23 11:34:24] WARN  TCPServer Error: Address already in use - bind(2)
[2014-01-23 11:34:24] WARN  TCPServer Error: Address already in use - bind(2)
== Someone is already performing on port 4567!
like image 527
Jeff Avatar asked Jan 23 '14 16:01

Jeff


1 Answers

When pressing Ctrl+Z, you are pausing an application and sending it to the background. It will not execute but it will not be killed either and resources used by it (e.g. open files or network sockets) continue to be bound to the application.

You can resume the app by running fg (which is short for foreground) in your shell.

like image 103
Holger Just Avatar answered Oct 11 '22 05:10

Holger Just