sergio_educacionit

monitor de procesos

Aug 12th, 2026
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. UMBRAL=80
  4.  
  5. ps -eo pid,user,%cpu,comm --no-headers | while read pid usuario cpu proceso
  6. do
  7. cpu_entero=${cpu%.*}
  8.  
  9. if [ "$cpu_entero" -ge "$UMBRAL" ]; then
  10. echo "[ALERTA] El proceso '$proceso' (PID: $pid) del usuario '$usuario' consume ${cpu}% de CPU."
  11. fi
  12. done
Advertisement
Add Comment
Please, Sign In to add comment