Bug#598957: Want to make output of informational message depend on "--cron"?

Florian Hinzmann fh at debian.org
Tue Dec 21 07:42:26 UTC 2010


This message did not make it to the bug tracking system. Trying
again.
 --Florian Hinzmann

Begin forwarded message:

Date: Thu, 9 Dec 2010 15:47:23 +0100
From: Florian Hinzmann <mail at fhinzmann.de>
To: 598957 at bugs.debian.org, Debian mdadm maintainers <pkg-mdadm-devel at lists.alioth.debian.org>
Subject: Want to make output of informational message depend on "--cron"?


Hello!


I'd like to make a suggestion for consideration:

http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=blobdiff;f=debian/checkarray;h=dafc652930cab7ab19d3e148d81fbbe3527002cf;hp=bd15ad5fe2538b488e7c1dd666fcf6d95eed8597;hb=0b80e69a2a980be27d30536099b69e76688ba7cc;hpb=1e484e02b5c31afb1cd19f12ded5f49a0ccff794
lists the following as a fix to make checkarray silent when
run by the default cron job:

--- a/debian/checkarray
+++ b/debian/checkarray
@@ -193,7 +193,9 @@ for array in $arrays; do
         wait=$((wait - 1))
         resync_pid=$(ps -ef | awk -v dev=$array 'BEGIN { pattern = "^\\[" dev "_resync]$" } $8 ~ pattern { print $2 }')
         if [ -n "$resync_pid" ]; then
-          echo "$PROGNAME: I: selecting $ionice I/O scheduling class for resync of $array." >&2
+          if [ $cron != 1 ]; then
+            echo "$PROGNAME: I: selecting $ionice I/O scheduling class for resync of $array." >&2
+          fi
           ionice -p "$resync_pid" $arg
           break
         fi


My own fix was this:

root at marvin:~# diff -u /usr/share/mdadm/checkarray.20101209.dist.not-quiet /usr/share/mdadm/checkarray
--- /usr/share/mdadm/checkarray.20101209.dist.not-quiet	2010-09-03 11:11:00.000000000 +0200
+++ /usr/share/mdadm/checkarray	2010-12-09 15:29:38.000000000 +0100
@@ -193,7 +193,7 @@
         wait=$((wait - 1))
         resync_pid=$(ps -ef | awk -v dev=$array 'BEGIN { pattern = "^\\[" dev "_resync]$" } $8 ~ pattern { print $2 }')
         if [ -n "$resync_pid" ]; then
-          echo "$PROGNAME: I: selecting $ionice I/O scheduling class for resync of $array." >&2
+          [ $quiet -lt 1 ] && echo "$PROGNAME: I: selecting $ionice I/O scheduling class for resync of $array." >&2
           ionice -p "$resync_pid" $arg
           break
         fi


It is my understanding that making it depend on --quiet rather than
--cron is more consistent with both other informational messages written
by checkarray and its documentation:

> [...]
> -c|--cron          honour AUTOCHECK setting in /etc/default/mdadm.
> -q|--quiet         suppress informational messages.
> [...]


 Regards

 Florian




-- 
  Florian Hinzmann                         private: mail at fhinzmann.de
                                            Debian: fh at debian.org 
PGP Key / ID: 1024D/B4071A65
Fingerprint : F9AB 00C1 3E3A 8125 DD3F  DF1C DF79 A374 B407 1A65


-- 
  Florian Hinzmann                         private: mail at fhinzmann.de
                                            Debian: fh at debian.org 
PGP Key / ID: 1024D/B4071A65
Fingerprint : F9AB 00C1 3E3A 8125 DD3F  DF1C DF79 A374 B407 1A65





More information about the pkg-mdadm-devel mailing list