简体   繁体   中英

Kill Resque Workers from Ruby

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM