status 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. infosys_src () {
  3. #HORA Y FECHA
  4. unset _hora
  5. unset _fecha
  6. _hora=$(printf '%(%H:%M:%S)T')
  7. _fecha=$(printf '%(%D)T')
  8. #PROCESSADOR
  9. unset _core
  10. unset _usop
  11. _core=$(printf '%-1s' "$(grep -c cpu[0-9] /proc/stat)")
  12. _usop=$(printf '%-1s' "$(top -bn1 | awk '/Cpu/ { cpu = "" 100 - $8 "%" }; END { print cpu }')")
  13. #MEMORIA RAM
  14. unset ram1
  15. unset ram2
  16. unset ram3
  17. ram1=$(free -h | grep -i mem | awk {'print $2'})
  18. ram2=$(free -h | grep -i mem | awk {'print $4'})
  19. ram3=$(free -h | grep -i mem | awk {'print $3'})
  20. unset _ram
  21. unset _usor
  22. _ram=$(printf ' %-9s' "$(free -h | grep -i mem | awk {'print $2'})")
  23. _usor=$(printf '%-8s' "$(free -m | awk 'NR==2{printf "%.2f%%", $3*100/$2 }')")
  24. unset os_sys
  25. os_sys=$(echo $(cat -n /etc/issue |grep 1 |cut -d' ' -f6,7,8 |sed 's/1//' |sed 's/ //')) && echo $system|awk '{print $1, $2}'
  26. bot_retorno="$LINE\n"
  27. bot_retorno+="S.O: $os_sys\n"
  28. bot_retorno+="Su IP es: $(meu_ip)\n"
  29. bot_retorno+="$LINE\n"
  30. bot_retorno+="Ram: $ram1 || En Uso: $_usor\n"
  31. bot_retorno+="USADA: $ram3 || LIBRE: $ram2\n"
  32. bot_retorno+="$LINE\n"
  33. bot_retorno+="CPU: $_core || En Uso: $_usop\n"
  34. bot_retorno+="$LINE\n"
  35. bot_retorno+="FECHA: $_fecha\n"
  36. bot_retorno+="HORA: $_hora\n"
  37. bot_retorno+="$LINE\n"
  38. msj_fun
  39. }