How to manually (terminal command) delete queue workers
I created too many processes of queue workers in Forge. The memory on my server could not handle it. I tried deleting the workers via the Forge interface, however my server was still overloaded and did not get the delete message from Forge. (As a matter of fact, my site went down because the server was too overloaded) Forge now shows 1 active worker, but when I check worker status it still shows the 51 processes. I have upgraded the memory on my server so I can try to delete the 50 processes, but because they are not listed on the Active Workers list in Forge, I am unable to remove them. Is there a terminal command I can run to delete the workers?
You have to kill the processes yourself on the server. So if you run top on the command line you can see all processes that are running. Then find the process you want to kill and find the id of that process in the table you get from top. It's called the PID. If you have the correct PID you can then run this
Thank you. It looks like we are on the right track. I am able to kill the process easily as Forge provides me with all of the PIDs. But the problem is that it seems like the process revives itself as a new process. I am not noticing less queue workers, I have the same number after killing; new ones come up with new PIDs and a shorter uptime.
So I've found the docs for Supervisord here:
http://supervisord.org/running.html#signals
and found that supervisorctl stop <task name> stops the process. Doing a php artisan queue:restart does not restart it...which is good. However I am not able to delete the process. It just sits there with a status of "STOPPED". I am trying to figure out how to delete it for good and there doesn't seem to be a supverisorctl command for that...
Finally figured it out. Laravel Queue Workers are monitored by Supervisor (supervisord). A queue worker (or group of workers) are automatically configured by Forge using the GUI. When a queue worker is created by Forge, it creates a worker-[id].conf file in /etc/supervisor/conf.d When a queue worker is removed via the Forge GUI, the worker-[id].conf file is simply deleted (a restart may need to occur).
So the answer to my question "How to manually delete queue workers": SSH into the server, navigate to /etc/supervisor/conf.d folder and delete the worker-[id].conf files. After that, run sudo service supervisord restart, or sudo supervisorctl and then reread.