]> code.delx.au - monosys/blob - hacks/smart-stats
smart-stats: read devices from /etc/smartd.conf
[monosys] / hacks / smart-stats
1 #!/bin/bash
2
3 DISKS="$(grep -Eo '^/dev/[^ ]+' /etc/smartd.conf)"
4
5 for dev in $DISKS; do
6 name="$(basename "$dev" | sed 's/^ata-//')"
7 logfile="/var/log/smart/${name}/$(date +%Y-%m-%d_%H:%M).txt"
8 mkdir -p "$(dirname "$logfile")"
9 smartctl -a "$dev" > "$logfile"
10 done
11
12 exit 0