One kills the specified process
Now know that a PHP thread is running and need to kill
Root 26278 1 0 2015? 00:00:31/usr/local/php/bin/php/var/www/html/redis/daemon/daemon_register.php
Root 26280 1 0 2015? 00:00:34/usr/local/php/bin/php/var/www/html/redis/daemon/daemon_register.php
PS-EF Query Run Process
[Email protected]$ ps-ef | grep php
Root 26278 1 0 2015? 00:00:31/usr/local/php/bin/php/var/www/html/redis/daemon/daemon_register.php
Root 26280 1 0 2015? 00:00:34/usr/local/php/bin/php/var/www/html/redis/daemon/daemon_register.php
Ps-ef Query and filter the process ID:
[Email protected]$ ps-ef | grep php
Root 26278 1 0 2015? 00:00:31/usr/local/php/bin/php/var/www/html/redis/daemon/daemon_register.php
Root 26280 1 0 2015? 00:00:34/usr/local/php/bin/php/var/www/html/redis/daemon/daemon_register.php
[Email protected]$ ps-ef | grep php | Grep-v grep | Cut-c 15-20
26280
26280
PS-EF queries and filters the process ID and kills the process:
[Email protected]$ ps-ef | grep php
Root 26278 1 0 2015? 00:00:31/usr/local/php/bin/php/var/www/html/redis/daemon/daemon_register.php (before killing process)
Root 26278 1 0 2015? 00:00:31/usr/local/php/bin/php/var/www/html/redis/daemon/daemon_register.php
[Email protected]$ ps-ef | grep Curl | Grep-v php | Cut-c 15-20
28367
[Email protected]$ ps-ef | grep php | Grep-v grep | Cut-c 15-20 | Xargs kill-9
[Email protected]$ ps-ef | grep php
Root 26278 1 0 2015? 00:00:31/usr/local/php/bin/php/var/www/html/redis/daemon/daemon_register.php (no this process after killing the process)
Or:
Kill-9 ' Ps-ef|grep "ProcessName" | Grep-v "grep" |awk ' {print $} '
Two kills batch process
For PID in $ (ps-ef | grep Curl | grep-v grep | cut-c 15-20); Do (get an array of process IDs and cycle through all processes)
Echo $pid
Kill-9 $pid
Done
Advised June: Kill is dangerous, use must be cautious.
Linux kill kills the specified process