Kill all resque workers with a single command
We are using God to start workers on all servers, both front end and back end (with different queues).
God sometimes has an issue with leaving some stale workers laying around which cache old code, so if you change your code, this is your enemy since you start seeing failed jobs that should not fail what so ever.
Even when you stop the rakes (Workers run by rake) with god, it will still leave those lying around.
In one word, Frustrating…
So, I was IM’ng with Chiu-Ki and we were talking about killing workers, and I was telling her how to kill those.
She told me she has a shell script for it.
There you go…
sudo kill -9 `ps aux | grep [r]esque | grep -v grep | cut -c 10-16`
and if you just want to test before doing some killing, you can run this:
echo `ps aux | grep [r]esque | grep -v grep | cut -c 10-16`
Of course after this GOD will restart the workers with the new code and that’s it, you have fresh workers, with new code, ready to be up and running.
<img src="http://feeds.feedburner.com/~r/KensoDev-en/~4/ORIAhHrW7nE" height="1" width="1"/>