summaryrefslogtreecommitdiffstats
path: root/remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl
diff options
context:
space:
mode:
authorChristian Rößler2016-11-04 15:59:25 +0100
committerChristian Rößler2016-11-04 15:59:25 +0100
commit13a665d7317615b472a66ce08fe6c0d126cdea39 (patch)
treed5fd4b5f9879f97b5032fc99951d6d3aafc7e7df /remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl
parent[run-virt] resolution scripts now detect first connected output device (not o... (diff)
parent[rfs-stage32] Run update-issue after setup_partitions for proper /tmp display (diff)
downloadtm-scripts-13a665d7317615b472a66ce08fe6c0d126cdea39.tar.gz
tm-scripts-13a665d7317615b472a66ce08fe6c0d126cdea39.tar.xz
tm-scripts-13a665d7317615b472a66ce08fe6c0d126cdea39.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