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!
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 (eg 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.
I had a similar error, but the command fg
didn't help. I used the command lsof -i :4567
to find which process has the port open, and then I stopped it with kill PROCESS_ID
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.