Getting hard disk temperature

Submitted by Swobodin on Mon, 2006-05-01 12:41. ::
I have found in Linux Gazette an interesting tip to figure out about hard disk temperature, and therefore, to guess about how hot is your computer.
Assuming that smartctl is installed with kernel-utils package, type, as root:
Temperature is 35°C, pretty hot!
You may use a shell script to get temperature status
Add the following value to your sudoers file
Append to group "users" the users you want, in your /etc/group
and restrict usage to the group
Assuming that smartctl is installed with kernel-utils package, type, as root:
smartctl -a /dev/hda | grep 194
194 Temperature_Celsius 0x0022 035 055 000 Old_age Always - 35
Temperature is 35°C, pretty hot!
You may use a shell script to get temperature status
#!/bin/sh
# File: temperature.sh
TEMPC=$(sudo /usr/sbin/smartctl -a /dev/hda | grep 194 | awk '{print $10}') #Temperature in degrees Celcius
echo "$TEMPC C"
TEMPF=$[ $TEMPC*9/5 +32 ] # Convert to degrees Farenheit
echo "Your hard disk temperature is"
echo "$TEMPC C"
echo "$TEMPF F"
if [ $TEMPC -gt 27 ]
then
echo "That's not suitable for your hardware, you should make the room colder"
else
echo "Temperature is okay"
fi
unset TEMPC TEMPF
Add the following value to your sudoers file
echo "%users ALL=NOPASSWD:/usr/sbin/smartctl -a /dev/hda" >> /etc/sudoers
Append to group "users" the users you want, in your /etc/group
users:x:100:tester,swobodin,foo,gates
and restrict usage to the group
chgrp users temperature.sh
chmod 754 temperature.sh
Recent comments
23 hours 30 min ago
1 week 1 day ago
1 week 5 days ago
2 weeks 1 day ago
3 weeks 3 days ago
3 weeks 4 days ago
6 weeks 2 days ago
7 weeks 2 days ago
7 weeks 4 days ago
8 weeks 1 day ago