To find which process is Using the swap space use the below Script to find the top 10 Process using Swap
----------------------------------------------------------------------------------------------------------------------------------------------------
ps ax | sed "s/^ *//" > /tmp/ps_ax.output
for x in $(grep Swap /proc/[1-9]*/smaps | grep -v '\W0 kB' | tr -s ' ' | cut -d' ' -f-2 | sort -t' ' -k2 -n | tr -d ' ' | tail -10); do
swapusage=$(echo $x | cut -d: -f3)
pid=$(echo $x | cut -d/ -f3)
procname=$(cat /tmp/ps_ax.output | grep ^$pid)
echo "============================"
echo "Process : $procname"
echo "Swap usage: $swapusage kB"; done
-------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------
ps ax | sed "s/^ *//" > /tmp/ps_ax.output
for x in $(grep Swap /proc/[1-9]*/smaps | grep -v '\W0 kB' | tr -s ' ' | cut -d' ' -f-2 | sort -t' ' -k2 -n | tr -d ' ' | tail -10); do
swapusage=$(echo $x | cut -d: -f3)
pid=$(echo $x | cut -d/ -f3)
procname=$(cat /tmp/ps_ax.output | grep ^$pid)
echo "============================"
echo "Process : $procname"
echo "Swap usage: $swapusage kB"; done
-------------------------------------------------------------------------------------------------------------------------------------------------------
No comments:
Post a Comment