-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtemperatures
executable file
·34 lines (27 loc) · 1.08 KB
/
temperatures
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
if [ "$USER" != "root" ]; then
echo "Needs to be root to be usable."
exit 1
fi
sensors | egrep ' Fan| Temp' ; echo
for dev in /dev/hd? /dev/sd?; do
if echo "$dev" | grep -q '/hd'; then
type=ata
else
type=auto
fi
smartctl -d $type -a $dev 2>&1 | grep Temperature_Celsius | \
while read line; do
# 194 Temperature_Celsius 0x0022 048 054 000 Old_age Always - 48 (Lifetime Min/Max 0/23)
# 194 Temperature_Celsius 0x0022 034 055 000 Old_age Always - 34 (0 23 0 0)
set -- `echo "$line"`
shift ; shift ; shift ; shift ; shift ; shift ; shift ; shift ; shift
set -- `echo "$*" | sed -e 's@/@ @' -e 's@(@@' -e 's@)@@'`
tmp1=`echo "$1"`
tmp2=`echo "$2"`
tmp3=`echo "$3"`
[ -z "$tmp2" -o "$tmp2" = "0" ] && tmp2=" "
[ -z "$tmp3" -o "$tmp3" = "0" ] && tmp3=" "
printf "$dev Temp: +$tmp1°C (low = %-2s°C, high = %-2s°C)\n" "+$tmp2" "+$tmp3"
done
done