# Can't stop webrick with ctrl-c or ctrl-d on linux host

**URL:** <https://www.ruby-forum.com/t/cant-stop-webrick-with-ctrl-c-or-ctrl-d-on-linux-host/195914>\
**Category:** Rails\
**Created:** [October 2, 2010, 8:14pm UTC](https://www.ruby-forum.com/t/cant-stop-webrick-with-ctrl-c-or-ctrl-d-on-linux-host/195914 "2010-10-02T20:14:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![maunzinha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@maunzinha](https://www.ruby-forum.com/u/maunzinha)\
**Post date:** [October 2, 2010, 8:14pm UTC](https://www.ruby-forum.com/t/cant-stop-webrick-with-ctrl-c-or-ctrl-d-on-linux-host/195914/1 "2010-10-02T20:14:29Z")

</div>

Hi All

I have setup a new dev system running LinuxMint 9 (Ubuntu 10.4).  
Running  
ruby 1.9.2, rails 3.0, RVM etc.

One issue I have run into is that I can’t stop webrick with ctrl+c or  
ctrl+d  
and killing the terminal always leaves a stranded ruby process.

Has anybody else run into this? Btw, webrick gets started by running  
“rails  
s” in.

Also, ctrl+c works fine to stop a standalone ruby or python apps. I can  
also  
exit irb with ctrl+d fine.

Anyhow, any help would be appreciated.

Thanks

Raf

---

<div class="post-metadata">

**Author:** ![maunzinha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@maunzinha](https://www.ruby-forum.com/u/maunzinha)\
**Post date:** [October 2, 2010, 8:38pm UTC](https://www.ruby-forum.com/t/cant-stop-webrick-with-ctrl-c-or-ctrl-d-on-linux-host/195914/2 "2010-10-02T20:38:29Z")

</div>

use ctrl + z

---

<div class="post-metadata">

**Author:** ![maunzinha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@maunzinha](https://www.ruby-forum.com/u/maunzinha)\
**Post date:** [October 3, 2010, 2:12am UTC](https://www.ruby-forum.com/t/cant-stop-webrick-with-ctrl-c-or-ctrl-d-on-linux-host/195914/3 "2010-10-03T02:12:40Z")

</div>

Thanks, that ACTUALLY worked 😉

The question is why does ctrl+z work and ctrl+c not?

Raf

On Sat, Oct 2, 2010 at 11:37 AM, Bala [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > ctrl+d and killing the terminal always leaves a stranded ruby process.
> > 
> > [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).  
> > [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

–  
[http://www.bdcsoftware.com](http://www.bdcsoftware.com)" - Automotive CRM

---

<div class="post-metadata">

**Author:** ![maunzinha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@maunzinha](https://www.ruby-forum.com/u/maunzinha)\
**Post date:** [October 3, 2010, 2:16am UTC](https://www.ruby-forum.com/t/cant-stop-webrick-with-ctrl-c-or-ctrl-d-on-linux-host/195914/4 "2010-10-03T02:16:46Z")

</div>

Spoke too soon. Ctrl+z stops the server script but the ruby process that  
listens on 3000 hangs around. After using ctrl+z, I can’t restart the  
server  
because the default port is still in use.

Raf

On Sat, Oct 2, 2010 at 5:11 PM, Rafael S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > On Sat, Oct 2, 2010 at 11:43 PM, Rafael S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)wrote:
> > 
> > > ## “rails s” in.
> > 
> > –
> 
> –  
> [http://www.bdcsoftware.com](http://www.bdcsoftware.com)" - Automotive CRM

–  
[http://www.bdcsoftware.com](http://www.bdcsoftware.com)" - Automotive CRM

---

<div class="post-metadata">

**Author:** ![maunzinha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@maunzinha](https://www.ruby-forum.com/u/maunzinha)\
**Post date:** [October 4, 2010, 8:52pm UTC](https://www.ruby-forum.com/t/cant-stop-webrick-with-ctrl-c-or-ctrl-d-on-linux-host/195914/5 "2010-10-04T20:52:23Z")

</div>

Rafael S. wrote:

> Spoke too soon. Ctrl+z stops the server script but the ruby process that  
> listens on 3000 hangs around. After using ctrl+z, I can’t restart the  
> server  
> because the default port is still in use.

Right – because C-z only _suspends_ the process and does not kill it.  
When you hit C-z, you will see a message that begins like  
[1]+ Stopped

The number in brackets is the job number. To kill the process, type  
kill -9 %{JOB}  
at the shell prompt, where {JOB} is the job number – so in this  
example, it would be kill -9 %1 .

I’ve never seen this with Webrick, but sometimes Autospec responds to  
C-z and not to C-c. The method I just described is useful.

If any of this is mysterious to you, please read a little about how  
processes work on \*nix.

> Raf

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![maunzinha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@maunzinha](https://www.ruby-forum.com/u/maunzinha)\
**Post date:** [October 4, 2010, 10:31pm UTC](https://www.ruby-forum.com/t/cant-stop-webrick-with-ctrl-c-or-ctrl-d-on-linux-host/195914/6 "2010-10-04T22:31:58Z")

</div>

oops sorry for not replying. hope you got the answer 🙂

On Tue, Oct 5, 2010 at 12:22 AM, Marnen Laibow-Koser

---

<div class="post-metadata">

**Author:** ![maunzinha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@maunzinha](https://www.ruby-forum.com/u/maunzinha)\
**Post date:** [October 3, 2010, 2:24am UTC](https://www.ruby-forum.com/t/cant-stop-webrick-with-ctrl-c-or-ctrl-d-on-linux-host/195914/7 "2010-10-03T02:24:23Z")

</div>

Ok, I started experimenting with different key combinations and it seems  
that ctrl+alt+c does the trick.

Raf

On Sat, Oct 2, 2010 at 5:15 PM, Rafael S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > > > Hi All  
> > > > Also, ctrl+c works fine to stop a standalone ruby or python apps. I can  
> > > > Groups “Ruby on Rails: Talk” group.  
> > > > “Ruby on Rails: Talk” group.  
> > > > –  
> > > > [http://www.bdcsoftware.com](http://www.bdcsoftware.com)" - Automotive CRM
> 
> –  
> [http://www.bdcsoftware.com](http://www.bdcsoftware.com)" - Automotive CRM

–  
[http://www.bdcsoftware.com](http://www.bdcsoftware.com)" - Automotive CRM
