Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- UMBRAL=80
- ps -eo pid,user,%cpu,comm --no-headers | while read pid usuario cpu proceso
- do
- cpu_entero=${cpu%.*}
- if [ "$cpu_entero" -ge "$UMBRAL" ]; then
- echo "[ALERTA] El proceso '$proceso' (PID: $pid) del usuario '$usuario' consume ${cpu}% de CPU."
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment