oomscore.sh 336 B

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