howe
howe copied to clipboard
Support displaying S.M.A.R.T. status
I've managed to hack something together using smartctl but It's not very pretty compared to the rest of the output.
I'd be real neat to see current status, drive hours, time of last self-test and what type (short/extended).
@Greybane not sure if you're still looking for something along these lines but I threw this together, made available via my bin dir, then executed via howe.
Example Output:
#!/bin/bash
# Check if smartctl is installed
command -v smartctl > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Error: smartctl command not found. Please install smartmontools."
exit 1
fi
bold=$(tput bold)
yellow=$(tput setaf 3)
reset=$(tput sgr0)
# Get a list of all hard drives
drives=$(lsblk -o NAME -n -d | grep -E '^sd|^hd')
# Display assessments for each drive
output+='\nDrive\tStatus\tTemp\tCycles'
for drive in $drives; do
smartResult=$(sudo smartctl -AH /dev/$drive)
# echo $smartResult
assessment=$(sudo smartctl -AH /dev/$drive | awk '/self-assessment/{print $6}')
cycles=$(sudo smartctl -AH /dev/$drive | awk '/Power_Cycle_Count/{print $10}')
temperature=$(sudo smartctl -AH /dev/$drive | awk '/Temperature_Celsius/{print $10}')
output+="\n$yellow$drive:$reset\t$assessment\t$temperature\t$cycles"
done
echo -e $output
I will say the advantage to this being separated from howe implementation itself, is that it's easily portable and executable standalone.