Advertisement
Guest User

Bash script to display CPU temp

a guest
Nov 22nd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.45 KB | None | 0 0
  1. #!/bin/bash
  2. t_warn=${1:-60}
  3. t_crit=${2:-75}
  4. t_curr=$(sensors -u acpitz-virtual-0 | awk '/input/{ printf "%d\n", $2}')
  5. if [[ "$t_curr" -lt "$t_warn" ]]
  6. then color="#90A959" #green - base16
  7. elif [[ "$t_curr" -ge "$t_warn" ]] && [[ "$t_curr" -lt "$t_crit" ]]
  8. then color="#D28445" #orange - base16
  9. else color="#AC4142" #red - base16
  10. fi
  11. # elements output for JSON (short text, full text, color)
  12. echo $t_curr"°"
  13. echo $t_curr"°"
  14. echo "$color"
  15. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement