summaryrefslogtreecommitdiffstats
path: root/remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl
diff options
context:
space:
mode:
authorJonathan Bauer2016-07-15 13:33:31 +0200
committerJonathan Bauer2016-07-15 13:33:31 +0200
commite95317dc5caf6907f1b8d8a900320480dc3ab17e (patch)
tree3e865f54c5a34724bd1a79fd8b1d062c48f5999d /remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl
parent[dnbd3] fix missing dependency on fusermount for dnbd3-fuse (diff)
parentUpdate several calls to slxlog with --delete instead of having sleep + rm fol... (diff)
downloadtm-scripts-e95317dc5caf6907f1b8d8a900320480dc3ab17e.tar.gz
tm-scripts-e95317dc5caf6907f1b8d8a900320480dc3ab17e.tar.xz
tm-scripts-e95317dc5caf6907f1b8d8a900320480dc3ab17e.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-smartctl10
1 files changed, 9 insertions, 1 deletions
diff --git a/remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl b/remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl
index 1eef0a23..979fde62 100755
--- a/remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl
+++ b/remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl
@@ -5,6 +5,7 @@
. /opt/openslx/config
[ -z "$SLX_SMARTCTL_MIN_REALLOC" ] && SLX_SMARTCTL_MIN_REALLOC=0
+DELAY=
FILES=
for dev in /dev/sd?; do
@@ -20,14 +21,21 @@ for dev in /dev/sd?; do
# report if applicable
if [ -n "$OVERALL" ]; then
slxlog "smartctl-fail" "Failed HDD: $dev reports health as $OVERALL" "$FILE"
+ DELAY=yes
fi
if [ -n "$REALLOC" ] && [ "$REALLOC" -gt "$SLX_SMARTCTL_MIN_REALLOC" ]; then
slxlog "smartctl-realloc" "Failing HDD: $dev has $REALLOC reallocated sectors!" "$FILE"
+ DELAY=yes
fi
if [ -n "$SPINRETRY_VAL" ] && [ "$SPINRETRY_VAL" -le "$SPINRETRY_THR" ]; then
slxlog "smartctl-spinretry" "Failing HDD: $dev has bad spin retry count! ($SPINRETRY_VAL/$SPINRETRY_THR)" "$FILE"
+ DELAY=yes
fi
done
-sleep 2 # give slxlog a little time, as it's running async
+
+[ -n "$DELAY" ] && sleep 2 # give slxlog a little time, as it's running async
[ -n "$FILES" ] && rm -f -- $FILES # list, no ""
+# Keep it that way instead of using --delete or --sync sonce it would add up; this way we're doing it just once here
+
+exit 0