From aa9d419b0c08bf08f79f483f966b95533496cea1 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Sun, 14 Nov 2021 09:23:50 +0100 Subject: shutdownasap: check raids more thoroughly --- shutdownasap.in | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/shutdownasap.in b/shutdownasap.in index df38d3e..af7a1c3 100755 --- a/shutdownasap.in +++ b/shutdownasap.in @@ -99,17 +99,23 @@ do fi fi - for synActFile in /sys/block/md*/md/sync_action - do - if [ -r "${synActFile}" ] && ! grep -q "^idle\$" "${synActFile}" - then - nochWarten=true - if ! ${quiet}; then - echo -n "raid ${synActFile}: " - cat "${synActFile}" - fi + errors=$( + find /sys/devices/virtual/block/ \ + -name 'array_state' \ + -exec grep -HvxF 'clean' {} + \ + , \ + -name 'sync_action' \ + -exec grep -HxF 'recover' {} + \ + , \ + -name 'degraded' \ + -exec grep -HvxF '0' {} + + ) || true + if [ -n "${errors}" ]; then + nochWarten=true + if ! ${quiet}; then + printf 'unclean raid array(s):\n%s\n' "${errors}" fi - done + fi for s in "${!shutDownNoGoProcesses[@]}" do -- cgit v1.2.3-70-g09d2