Skip to content

Instantly share code, notes, and snippets.

@grzegorzblaszczyk
Created September 1, 2011 07:24
Show Gist options
  • Save grzegorzblaszczyk/1185637 to your computer and use it in GitHub Desktop.
Save grzegorzblaszczyk/1185637 to your computer and use it in GitHub Desktop.
Check laptop temperature
#!/bin/bash
function print_usage {
echo "Usage: $0 [delay time in seconds]"
}
SLEEP_TIME=2
if [ "x$1" != "x" ]; then
if [[ $1 == "-h" || $1 == "--help" ]]; then
print_usage;
exit 0;
else
SLEEP_TIME=$1;
fi
fi
while [ 1==1 ]; do
TEMPERATURE=`cat /sys/class/thermal/thermal_zone0/temp`
DATE=`date`
echo -n "$DATE, CPU: "
echo "scale=1; $TEMPERATURE/1000" | bc | xargs echo -n ;
echo "°C"
sleep $SLEEP_TIME;
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment