- #!/bin/bash
- # sh oomscore.sh
- # 打印进程OOM参数, 容易被系统kill排前
- for proc in $(find /proc -maxdepth 1 -regex '/proc/[0-9]+'); do
- printf "%2d %5d %s\n" \
- "$(cat $proc/oom_score)" \
- "$(basename $proc)" \
- "$(cat $proc/cmdline | tr '\0' ' ' | head -c 50)"
- done 2>/dev/null | sort -nr | head -n 10
|