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 "========================================="
- echo "[ALERTA] Proceso: $proceso"
- echo "PID: $pid"
- echo "Usuario: $usuario"
- echo "CPU: ${cpu}%"
- echo
- echo "Archivos abiertos:"
- lsof -p "$pid"
- echo
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment