In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to list the processes that are occupying swap. The content of the article is of high quality. Therefore, Xiaobian shares it with you as a reference. I hope that after reading this article, you will have a certain understanding of relevant knowledge.
List the processes that are consuming swap
#!/ bin/bash
###############################################################################
#Date: October 31, 2011
#Author: xiaoxi227
# Email : xiaoxi227@163.com
# QQ : 543928910
#Version: 1.0
#Script function: List the processes that are consuming swap.
#Call relationship:
#Other Notes:
###############################################################################
echo -e "PID\t\tSwap\t\tProc_Name"
#Take out all directories named by numbers under/proc directory (process name is number is process, others such as sys,net are other information)
for pid in `ls -l /proc | grep ^d | awk '{ print $9 }'| grep -v [^0-9]`
do
#There is only one way for a process to release swap: restart the process. Or wait for it to release itself.
#If the process is automatically released, then we won't write scripts to find it, we will find it because it is not automatically released.
#So we want to list the processes that take up swap and need to be restarted, but init is the ancestor of all processes in the system
#Restarting the init process means restarting the system, which is absolutely not allowed, so there is no need to detect him, so as not to affect the system.
if [ $pid -eq 1 ];then continue;fi # Do not check init process
#Determine whether the change process occupies swap
grep -q "Swap" /proc/$pid/smaps 2>/dev/null
if [ $? -eq 0 ];then #if swap is occupied
swap=$(grep Swap /proc/$pid/smaps | gawk '{ sum+=$2;} END{ print sum }')
proc_name=$(ps aux | grep -w "$pid" | grep -v grep | awk '{ for(i=11;i
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.