0
votes

I'm using the following command to start 2 Resque background workers from my CLI.

COUNT=2 QUEUE=* rake resque:workers RAILS_ENV=production &

When I pull code updates from git to the server, I have to kill the background workers and rerun the command. I typically do something like this:

ps -u myuser # this shows me the process I started originally with the ids
kill -9 12345
kill -9 23456

Is there a way to kill these background workers from the Resque gem? I would like to create a rake task or a module in Ruby that would allow me to kill and restart these workers.

1
What other rake tasks are there? rake -T can help explain.tadman
There are only 3: rake resque:failures:sort, rake resque:work, rake resque:workers but none allow me to stop a worker. @tadmanCannon Moyer
Not very helpful, then. Normally I deploy this kind of stuff in containers, so management is easier, but you could wrap this up in a systemd config to make it as easy as systemctl start and systemctl stop etc. That makes managing it on a production server a lot easier, especially as now you can check up on the worker status, too, plus log output gets automatically bridged to journalctl if your system uses that.tadman

1 Answers

0
votes

You can do something like pkill -9 -f resque* to kill -9 all processes where name matches resque*