On my Linux server I ran:
sudo thin start -p 80 -d
Now I'd like to restart the sever. The trouble is, I can't seem to get the old process to kill it. I tried:
netstat -anp
But what I see on port 80 is this:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
So, it didn't give me a PID to kill…
I tried pgrep -l thin
but that gave me nothing. Meanwhile pgrep -l ruby
gives me like 6 processes running. I don't really understand why multiple ruby threads would be running, or which one I need to kill…
How do I kill / restart the thin daemon?
Best Answer
thin
is a Ruby gem, so it only makes sense that the Ruby interpreter would be running it.A typical invocation of
thin
would be:In the process list, from the
ps
command, this appears something like:When using
pgrep
, by default it only matches against the command name (i.e.ruby
). This won't match when the pattern you're searching for appears in the arguments. For this, you need to use the-f
option as well:The return then appears like this:
And voila, there is the process you're looking for.