Kill all resque workers with a single command

Posted on Sep 16, 2011

At Gogobot we are running background processes with Resque.

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 here how to kill those.

She told me she has a shell script for it.

There you go…

and if you just want to test before doing some killing, you can run this:

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.