cpu 518 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. source /etc/clara.sh
  3. loadavg=$(cat /proc/loadavg | awk '{print $1}' )
  4. tmp_loadavg=$(echo "$loadavg * 100" | bc -l | cut -d'.' -f1)
  5. if [ $tmp_loadavg -ge 90 ]; then
  6. if [ ! -f cpu.txt ]; then
  7. echo >cpu.txt
  8. echo """
  9. hi
  10. i'm clara. a server Manager bot
  11. the server CPU Load average is greater than 0.9
  12. """ | mutt -s "CPU Lo" $email
  13. fi
  14. else
  15. if [ -e "cpu.txt" ]; then
  16. rm -Rf cpu.txt
  17. echo """
  18. hi
  19. i'm clara. a server Manager bot
  20. the server CPU returned to normal sstatuss
  21. """ | mutt -s "CPU good" $email
  22. fi
  23. fi