Skip to content

Instantly share code, notes, and snippets.

@mdpuma
Created November 9, 2017 19:21
Show Gist options
  • Select an option

  • Save mdpuma/6f5aa62a97de9062a54356325dab14cc to your computer and use it in GitHub Desktop.

Select an option

Save mdpuma/6f5aa62a97de9062a54356325dab14cc to your computer and use it in GitHub Desktop.
get_drive_temp.sh
#!/bin/bash
raid=cciss
maxdisks=7
for i in {0..7}; do
temp=$(smartctl -a -d $raid,$i /dev/sda | grep "Current Drive Temperature:" | awk -F: '{ print $2}')
[ -z "$temp" ] && temp=$(smartctl -a -d $raid,$i /dev/sda | grep "Temperature_Celsius" | grep -oE "[0-9]+" | xargs | cut -d ' ' -f7);
[ -n "$temp" ] && echo slot $i: $temp;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment