diff options
author | Dmitry Marakasov <amdmi3@FreeBSD.org> | 2010-02-07 12:31:11 +0000 |
---|---|---|
committer | Dmitry Marakasov <amdmi3@FreeBSD.org> | 2010-02-07 12:31:11 +0000 |
commit | e5a04ac37d053787bbe61b21eb4ac7c5b3c48edf (patch) | |
tree | b6c9e5e76953b2bf472df0860a3f7291d8296ad4 /sysutils | |
parent | 66a14a10df86414b5a20613a069e01f305a1a500 (diff) | |
download | ports-e5a04ac37d053787bbe61b21eb4ac7c5b3c48edf.tar.gz ports-e5a04ac37d053787bbe61b21eb4ac7c5b3c48edf.zip |
Notes
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/smartmontools/Makefile | 2 | ||||
-rw-r--r-- | sysutils/smartmontools/files/smart.in | 39 |
2 files changed, 29 insertions, 12 deletions
diff --git a/sysutils/smartmontools/Makefile b/sysutils/smartmontools/Makefile index 1470e09fd21a..2c6c558fccbb 100644 --- a/sysutils/smartmontools/Makefile +++ b/sysutils/smartmontools/Makefile @@ -7,7 +7,7 @@ PORTNAME= smartmontools PORTVERSION= 5.39 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= sysutils MASTER_SITES= SF diff --git a/sysutils/smartmontools/files/smart.in b/sysutils/smartmontools/files/smart.in index e63b094be5f7..713ece59b70d 100644 --- a/sysutils/smartmontools/files/smart.in +++ b/sysutils/smartmontools/files/smart.in @@ -29,7 +29,7 @@ fi trim_junk="tail -n +4" -tmpfile="$(mktemp /var/run/daily.XXXXXXXX)" +tmpfile="$(mktemp -t daily)" trap "rm -f ${tmpfile}" 0 1 3 15 rc=0 @@ -37,24 +37,41 @@ case "${daily_status_smart_enable}" in [Yy][Ee][Ss]) cd /dev for device in ${daily_status_smart_devices}; do + device="${device#/dev/}" + devflags="" + case ${device} in + cd*) continue + ;; + tw[ae]*) devflags="-d3ware,${device#tw[ae][0-9]*,}" + device="/dev/${device%,[0-9]*}" + ;; + /*) ;; + *) device="/dev/${device}" + ;; + esac + if [ -e ${device} ]; then - echo - echo "Checking health of ${device}:" - echo - ${smartctl} ${daily_status_smartctl_flags} /dev/${device} > "${tmpfile}" + echo -n "Checking health of ${device}" + if [ -n "${devflags}" ]; then + echo -n " (${devflags})" + fi + echo -n ": " + + ${smartctl} ${devflags} ${daily_status_smartctl_flags} ${device} > "${tmpfile}" status=$? - if [ $((status & 3)) -ne 0 ]; then + if [ ${status} -eq 0 ]; then + echo "OK" + elif [ $((status & 3)) -ne 0 ]; then rc=2 ${trim_junk} "${tmpfile}" - elif [ $status -ne 0 ]; then - rc=1 - ${smartctl} ${daily_status_smartctl_extra_status_flags} ${device} | ${trim_junk} else - ${trim_junk} "${tmpfile}" + rc=1 + ${smartctl} ${devflags} ${daily_status_smartctl_extra_status_flags} \ + ${device} | ${trim_junk} fi fi done ;; esac -exit "$rc" +exit "${rc}" |