diff options
-rwxr-xr-x | shutdownasap.in | 26 |
1 files 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 |