How to realize the process of batch killing under rhel5
In this issue, the editor will bring you about how to achieve the mass killing process under rhel5. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
If there is something wrong with the server, you need to forcibly kill a batch of processes. If it is troublesome to kill one by one, summarize two simple and quick statements to facilitate the use of this record to share.
The second column of digits is the PID process number, and the third column of digits is the PPID process number. You only need to extract the second column of numbers, because PPID is the parent process of the process.
Method 1:
# ps-ef | grep sap | awk'{print $2} 'use AWK to extract the ID numbers of the second column of processes
After confirmation, use # ps-ef | grep sap | grep-v grep | cut-c 9-15 | xargs kill-9 kill all
Then # ps-ef | grep sap just check again to make sure.
Add:
The cut command can extract text columns from a text file or text stream
Command usage:
Cut-b list [- n] [file...]
Cut-c list [file...]
Cut-f list [- d delim] [- s] [file...]
-b,-c,-f represent bytes, characters, and fields (i.e. byte, character, field)
List denotes the operating range of-b,-c,-f, and-n often indicates specific numbers.
File represents, of course, the name of the text file to be operated on.
Delim (delimiter) indicates the delimiter, which is TAB by default
-s does not include lines that do not contain delimiters (this helps to remove comments and headers)
The representation of the range:
N has only item N
N-from item N to the end of the line
Nmurm from item N to item M (including M)
-M from the beginning of a line to item M (including M)
-all items from the beginning to the end of a line
The above is the editor for you to share how to achieve the mass killing process under rhel5, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.