Created
February 20, 2020 06:58
-
-
Save subtly/c9ec066287fbd95545cc2b0c3b490f8e to your computer and use it in GitHub Desktop.
Get disk temperatures in macOS (nvme can get hot)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
lines = `diskutil list physical|grep dev|awk -F ' ' '{print $1}'` | |
lines.gsub(/\/dev\//, '').each_line do |line| | |
out = `smartctl -A -f brief #{line}` if !!(line.gsub!(/\s/,'') =~ /\Adisk\d+\z/) | |
puts "#{line}: " + out.split("\n").grep(/Temperature:/).first.split(/\s/)[-2] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment