diff options
author | Erich Eckner <git@eckner.net> | 2021-11-14 09:23:50 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2021-11-14 09:23:50 +0100 |
commit | aa9d419b0c08bf08f79f483f966b95533496cea1 (patch) | |
tree | 490e0d62802dd104a5fcc1dfaab15abd94fbbdfb | |
parent | 4d3cfa4ef641d92749668d596d66ebf0230c3da0 (diff) | |
download | shutdownasap-aa9d419b0c08bf08f79f483f966b95533496cea1.tar.xz |
shutdownasap: check raids more thoroughly
-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 |