rpi-temp.sh 463 B

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. ALERT=0
  3. CORE=1
  4. SENSORS=/usr/bin/sensors
  5. for N in `$SENSORS|grep Core|cut -f 2 -d "+" | cut -f 1 -d "."`
  6. do
  7. if [ $N -gt "80" ];
  8. then
  9. echo "ALERT: CPU core $CORE temperature to high, $N degrees Celcius"
  10. ALERT=1
  11. else
  12. echo "OK: CPU core $CORE Temperature $N degrees Celcius"
  13. fi
  14. CORE=$((CORE+1))
  15. done
  16. if [ $ALERT -eq "1" ];
  17. then
  18. exit 2
  19. else
  20. exit 0
  21. fi