summaryrefslogtreecommitdiff
path: root/debian/checkarray
diff options
context:
space:
mode:
authorMichael Tokarev <mjt@tls.msk.ru>2012-01-10 19:59:44 +0400
committerMichael Tokarev <mjt@tls.msk.ru>2012-01-10 19:59:44 +0400
commit04145749363e0180e8014b37eb3dfe59450f9bd4 (patch)
tree4dffac87787e5751854af041bdc5da1f1e7d4021 /debian/checkarray
parent03fdd1c4268ae5464bf2319cc0767d60789ddaf9 (diff)
small changes for debian/checkarray
remove usage of $SYNC_ACTION_CTL in favour of $MDBASE/sync_action since $MDBASE is (and will be) used in other places. While at it, replace var=$(cat foo) with read var < foo construct
Diffstat (limited to 'debian/checkarray')
-rw-r--r--debian/checkarray16
1 files changed, 8 insertions, 8 deletions
diff --git a/debian/checkarray b/debian/checkarray
index 96538e33..2043d8cd 100644
--- a/debian/checkarray
+++ b/debian/checkarray
@@ -139,33 +139,33 @@ fi
[ $all = 1 ] && arrays="$(ls -d1 /sys/block/md* | cut -d/ -f4)"
for array in $arrays; do
- SYNC_ACTION_CTL=/sys/block/$array/md/sync_action
+ MDBASE=/sys/block/$array/md
- if [ ! -e $SYNC_ACTION_CTL ]; then
+ if [ ! -e $MDBASE/sync_action ]; then
[ $quiet -lt 1 ] && echo "$PROGNAME: I: skipping non-redundant array $array." >&2
continue
fi
- cur_status="$(cat $SYNC_ACTION_CTL)"
+ read cur_status < $MDBASE/sync_action
if [ $action = status ]; then
echo "$array: $cur_status"
continue
fi
- if [ ! -w $SYNC_ACTION_CTL ]; then
- [ $quiet -lt 2 ] && echo "$PROGNAME: E: $SYNC_ACTION_CTL not writeable." >&2
+ if [ ! -w $MDBASE/sync_action ]; then
+ [ $quiet -lt 2 ] && echo "$PROGNAME: E: $MDBASE/sync_action not writeable." >&2
exit 4
fi
- if [ "$(cat /sys/block/$array/md/array_state)" = 'read-auto' ]; then
+ if [ "$(cat $MDBASE/array_state)" = 'read-auto' ]; then
[ $quiet -lt 1 ] && echo "$PROGNAME: W: array $array in auto-read-only state, skipping..." >&2
continue
fi
case "$action" in
idle)
- echo $action > $SYNC_ACTION_CTL
+ echo $action > $MDBASE/sync_action
[ $quiet -lt 1 ] && echo "$PROGNAME: I: cancel request queued for array $array." >&2
;;
@@ -177,7 +177,7 @@ for array in $arrays; do
# queue request for the array. The kernel will make sure that these requests
# are properly queued so as to not kill one of the array.
- echo $action > $SYNC_ACTION_CTL
+ echo $action > $MDBASE/sync_action
[ $quiet -lt 1 ] && echo "$PROGNAME: I: check queued for array $array." >&2
case "$ionice" in