SF.net SVN: logwatch:[209] scripts/services/mdadm

[email protected]
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Revision: 209
          http://sourceforge.net/p/logwatch/code/209
Author:   stefjakobs
Date:     2014-09-08 20:00:42 +0000 (Mon, 08 Sep 2014)
Log Message:
-----------
mdadm: catch 'cannot open ...' error (Thanks: gulikoza)

Modified Paths:
--------------
    scripts/services/mdadm

Modified: scripts/services/mdadm
===================================================================
--- scripts/services/mdadm	2014-09-08 19:50:58 UTC (rev 208)
+++ scripts/services/mdadm	2014-09-08 20:00:42 UTC (rev 209)
@@ -44,8 +44,14 @@
 foreach my $dev (@devices) {
   my %mdhash;
 
-  open(MDADM,"mdadm --misc --detail $dev |");
+  open(MDADM,"mdadm --misc --detail $dev 2>&1 |");
   while (<MDADM>) {
+    if ($_ =~ /cannot open .*: No such file or directory/) {
+      print $_;
+      close(MDADM);
+      next;
+    }
+
     $mdhash{'level'} = $1 if ($_ =~ /Raid Level ?: ?(.*)$/);
     $mdhash{'active'} = $1 if ($_ =~ /Active Devices ?: ?(.*)$/);
     $mdhash{'working'} = $1 if ($_ =~ /Working Devices ?: ?(.*)$/);

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.