kill all ruby processes
Public, Ruby General
harrylevine
Created: Mar 04, 2020 Updated: Mar 04, 2020
for each in `ps -eo pid,command | grep ruby | grep -v grep | awk '{print $1}' `; do kill -9 $each;done
killall −9 ruby
pkill -9 ruby
pidof ruby | xargs kill -9
ps aux | grep sidekiq | awk '{print $2}' | xargs kill
From: http://alwayscoding.ca/momentos/2013/09/24/killing-all-ruby-processes/
Let's say we cant to kill a puma
process. First we find all processes running associated with puma
$ ps aux | grep puma
harrylevine 2353 0.0 0.1 4670796 14948 ?? S 12:53PM 0:07.74 puma: cluster worker 1: 837 [zestful_app]
harrylevine 862 0.0 0.0 4642368 6068 ?? S Tue08AM 0:13.50 puma: cluster worker 0: 837 [zestful_app]
harrylevine 14347 0.0 0.0 4267948 408 s003 R+ 12:01PM 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn puma
Then let's say we want to kill the first one, which has the PID
of 2353
. We run:
$ kill -9 2353