#! /bin/bash ### ### Check the health of attached physical disks. set -e if [ ! -x /usr/sbin/smartctl ]; then exit 0; fi ## Build a list of actual disk devices according to their buses. disks= for p in /sys/class/block/*; do bus=none devtype=none idtype=none while read code assg; do case "$assg" in DEVNAME=*) name=${assg#*=} ;; ID_BUS=*) bus=${assg#*=} ;; DEVTYPE=*) devtype=${assg#*=} ;; ID_TYPE=*) idtype=${assg#*=} ;; esac done <