There is a server with a lot of send.php processes that need to kill
[Email protected]]#ps-aux | grep send.php
Warning:bad syntax, perhaps a bogus '-'? See/usr/share/doc/procps-3.2.8/faq
Root 8408 0.0 0.0 106096 1160? Ss 10:38 0:00/bin/sh-c Sleep 27; /usr/bin/flock-xn/tmp/smsinformuserqueue10.lock-c '/usr/local/php/bin/php/www/core/app/cron/sms/send.php Smsinformuserqueue >/dev/null 2>&1 '
Root 8471 0.0 0.0 106096 1160? Ss 10:38 0:00/bin/sh-c Sleep 27; /usr/bin/flock-xn/tmp/smsinformuserqueue9.lock-c '/usr/local/php/bin/php/www/core/app/cron/sms/send.php Smsinformuserqueue 9 >/dev/null 2>&1 '
Root 8548 0.0 0.0 106096 1156? Ss 10:38 0:00/bin/sh-c Sleep 27; /usr/bin/flock-xn/tmp/smsinformuserqueue3.lock-c '/usr/local/php/bin/php/www/core/app/cron/sms/send.php Smsinformuserqueue 3 >/dev/null 2>&1 '
Root 8745 0.0 0.0 106096 1160? Ss 10:38 0:00/bin/sh-c Sleep 26; /usr/bin/flock-xn/tmp/smsinformuserqueue.lock-c '/usr/local/php/bin/php/www/core/app/cron/sms/send.php Smsinformuserqueue 1 >/dev/null 2>&1 '
Root 8767 0.0 0.0 106096 1164? Ss 10:38 0:00/bin/sh-c Sleep 24; /usr/bin/flock-xn/tmp/smsinformuserqueue2.lock-c '/usr/local/php/bin/php/www/core/app/cron/sms/send.php Smsinformuserqueue 2 >/dev/null 2>&1 '
Root 9483 0.0 0.0 100892 532? S 10:38 0:00/usr/bin/flock-xn/tmp/smsinformuserqueue2.lock-c/USR/LOCAL/PHP/BIN/PHP/WWW/CORE/APP/CRON/SMS/SEND.P HP Smsinformuserqueue 2 >/dev/null 2>&1
Root 9484 0.0 0.0 106096 1144? S 10:38 0:00/bin/sh-c/usr/local/php/bin/php/www/core/app/cron/sms/send.php smsinformuserqueue 2 >/dev/null 2& Gt;&1
Root 9485 0.8 0.1 498880 30252? S 10:38 0:29/usr/local/php/bin/php/www/core/app/cron/sms/send.php Smsinformuserqueue 2
Root 9572 0.0 0.0 100892 536? S 10:38 0:00/usr/bin/flock-xn/tmp/smsinformuserqueue.lock-c/usr/local/php/bin/php/www/core/app/cron/sms/send.ph P Smsinformuserqueue 1 >/dev/null 2>&1
Root 9573 0.0 0.0 106096 1144? S 10:38 0:00/bin/sh-c
.....
If you follow the PID to kill each, the workload is too large
So I wrote a script kill.sh
#!/bin/bash
Processname= "send.php"
For PID in $ (PS aux |grep $processname |grep-v grep|awk ' {print $} '); Do
Kill-9 $pid
Done
Run directly, you can kill all the send.php processes.
This article is from the "Falling Star" blog, make sure to keep this source http://xiao987334176.blog.51cto.com/2202382/1769651
Linux Bulk Kill Process