Skip to content

Instantly share code, notes, and snippets.

@Nako
Last active April 28, 2024 12:15
Show Gist options
  • Save Nako/21d1a857fefae950d9afe8d9e4641af9 to your computer and use it in GitHub Desktop.
Save Nako/21d1a857fefae950d9afe8d9e4641af9 to your computer and use it in GitHub Desktop.
hard disk temperature, very simple script to print block device, model information, serial number, state, and temperature
#!/bin/bash
# https://gist.github.com/Nako/21d1a857fefae950d9afe8d9e4641af9
# very simple script to print block device - model - state - temperature
grep -l "drivetemp" /sys/class/hwmon/hwmon*/name | while read f;\
do echo `ls ${f%/*}/device/block` - `smartctl -a /dev/\`ls ${f%/*}/device/block\`| grep -i "Family"` - `smartctl -a /dev/\`ls ${f%/*}/device/block\`| grep -i "Serial"` - `cat ${f%/*}/device/model` - `cat ${f%/*}/device/state` - $((`cat ${f%/*}/temp1_input`/1000));
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment