aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authoramdmi3 <amdmi3@FreeBSD.org>2010-02-07 20:31:11 +0800
committeramdmi3 <amdmi3@FreeBSD.org>2010-02-07 20:31:11 +0800
commit99b3dc00d0bb95aab59fa7ab1d940aabe5f3d404 (patch)
tree2fef183ea797b4d7fa18147545d28f634bf03956 /sysutils
parenta55e4963403575f9c663ed494988c536a86ed4d8 (diff)
downloadfreebsd-ports-gnome-99b3dc00d0bb95aab59fa7ab1d940aabe5f3d404.tar.gz
freebsd-ports-gnome-99b3dc00d0bb95aab59fa7ab1d940aabe5f3d404.tar.zst
freebsd-ports-gnome-99b3dc00d0bb95aab59fa7ab1d940aabe5f3d404.zip
- More tweaks of periodic script
Submitted by: marck (maintainer)
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/smartmontools/Makefile2
-rw-r--r--sysutils/smartmontools/files/smart.in39
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}"