summaryrefslogtreecommitdiffstats
path: root/remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl
diff options
context:
space:
mode:
authorJonathan Bauer2014-01-24 18:29:44 +0100
committerJonathan Bauer2014-01-24 18:29:44 +0100
commit3e88ca7957918f16f8caa7714523636d15a844cb (patch)
treecc37940e62b40d6bfee06204ca1721fed320e847 /remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl
parent[stage4] added /var/cache/fontconfig to the list of directories to copy (diff)
parentMerge branch 'master' of dnbd3:openslx-ng/tm-scripts (diff)
downloadtm-scripts-3e88ca7957918f16f8caa7714523636d15a844cb.tar.gz
tm-scripts-3e88ca7957918f16f8caa7714523636d15a844cb.tar.xz
tm-scripts-3e88ca7957918f16f8caa7714523636d15a844cb.zip
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
Diffstat (limited to 'remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl')
-rwxr-xr-xremote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl6
1 files changed, 4 insertions, 2 deletions
diff --git a/remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl b/remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl
index 6a798563..1eef0a23 100755
--- a/remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl
+++ b/remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl
@@ -5,9 +5,11 @@
. /opt/openslx/config
[ -z "$SLX_SMARTCTL_MIN_REALLOC" ] && SLX_SMARTCTL_MIN_REALLOC=0
+FILES=
-FILE=$(mktemp)
for dev in /dev/sd?; do
+ FILE=$(mktemp)
+ FILES="$FILES $FILE"
smartctl -H -A -f "brief" "$dev" > "$FILE" || continue # should we report devices where smartctl doesn't work?
# parse
OVERALL=$(grep -o "test result: .*$" "$FILE" | cut -c 14-)
@@ -27,5 +29,5 @@ for dev in /dev/sd?; do
fi
done
sleep 2 # give slxlog a little time, as it's running async
-rm -f -- "$FILE"
+[ -n "$FILES" ] && rm -f -- $FILES # list, no ""