snmp_temp.sh 320 B

123456789101112131415
  1. #!/bin/bash
  2. if [ -z $1 ] ; then
  3. echo "No Paramters given."
  4. exit 1
  5. fi
  6. if [ "z${1}" == "zcpu" ] ; then
  7. cpu=$(</sys/class/thermal/thermal_zone0/temp)
  8. echo $((cpu/1000))
  9. exit 0
  10. elif [ "z${1}" == "zgpu" ] ; then
  11. gpu=$(/opt/vc/bin/vcgencmd measure_temp | cut -d "=" -f 2 | cut -d "'" -f 1)
  12. echo $gpu
  13. exit 0
  14. fi