19 lines
472 B
Bash
19 lines
472 B
Bash
#!/bin/bash
|
|
|
|
cmd_awk=`which awk`
|
|
cmd_grep=`which grep`
|
|
cmd_hddtemp=`which hddtemp`
|
|
cmd_smartctl=`which smartctl`
|
|
|
|
drvtemp=$(sudo $cmd_hddtemp $1)
|
|
hdd=$(echo "$drvtemp" | $cmd_awk -F: '{print $1}')
|
|
model=$(echo "$drvtemp" | $cmd_awk -F: '{print $2}')
|
|
result=$(sudo $cmd_smartctl -a $1 | $cmd_grep "Current Drive Temperature" | $cmd_awk '{print $4"°"$5}')
|
|
|
|
if [ -z "$result" ];
|
|
then
|
|
result=$(echo "$drvtemp" | $cmd_awk -F: '{print $3}')
|
|
fi
|
|
|
|
echo $hdd: $model: $result
|