viruszzz

get_temps

Jul 7th, 2011
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.23 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. red=$'\033[1;31m'
  4. cyan=$'\033[1;36m'
  5. white=$'\033[1;37m'
  6. #
  7. ######### Checking some neccesary staff  #########
  8. if [ $(whoami) != "root" ]; then
  9.     echo -e "\aYou can't run this script without being root or an sudoer :)"
  10.     exit 1
  11. fi
  12. which sensors  >/dev/null 2>&1
  13. if [ $? -ne 0 ]; then
  14.     echo -e "\aCan't proceed. Is lm_sensors installed?"
  15.     exit 1
  16. fi
  17. which hddtemp >/dev/null 2>&1
  18. if [ $? -ne 0 ]; then
  19.     echo -e "\aCan't proceed. Is hddtemp installed?"
  20.     exit 1
  21. fi
  22. ######### Getting some Values  #########
  23. _CPU1_TEMP=$(sensors|egrep -i '\w+\s+[0-9]'|awk '(NR<2){print $3}' )
  24. _CPU2_TEMP=$(sensors|egrep -i '\w+\s+[0-9]'|awk '(NR>1){print $3}')
  25. _DISK=$(df|egrep -o '/dev/\w{3}'|head -1)
  26. #
  27. echo -e ${white}"##########################################"
  28. echo -e ${cyan}"  ...::  Temps  for your machine   ::..."
  29. echo -e ${white}"##########################################"
  30. echo -e ${red}"------------------------------------------"
  31. echo -e ${cyan}" CPU1 TEMP:     $_CPU1_TEMP "
  32. echo -e ${cyan}" CPU2 TEMP:     $_CPU2_TEMP "
  33. echo -e ${red}"------------------------------------------"
  34. echo -e ${cyan}" $(hddtemp $_DISK | awk '{print $2 " " $3 " " "=>" " " $NF}')"
  35. echo -e ${white}"##########################################"
Advertisement
Add Comment
Please, Sign In to add comment