add script to calculate OOM score of a process
This commit is contained in:
parent
71aab07d62
commit
31c999bdb6
1 changed files with 5 additions and 0 deletions
5
oom_score.sh
Normal file
5
oom_score.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
# Displays running processes in descending order of OOM score
|
||||
# Source: https://dev.to/rrampage/surviving-the-linux-oom-killer-2ki9
|
||||
printf 'PID\tOOM Score\tOOM Adj\tCommand\n'
|
||||
while read -r pid comm; do [ -f /proc/$pid/oom_score ] && [ $(cat /proc/$pid/oom_score) != 0 ] && printf '%d\t%d\t\t%d\t%s\n' "$pid" "$(cat /proc/$pid/oom_score)" "$(cat /proc/$pid/oom_score_adj)" "$comm"; done < <(ps -e -o pid= -o comm=) | sort -k 2nr
|
||||
Loading…
Add table
Add a link
Reference in a new issue