oops, catch exec failure
authorStephen Gran <steve@lobefin.net>
Sat, 30 Jul 2011 12:40:05 +0000 (13:40 +0100)
committerStephen Gran <steve@lobefin.net>
Sat, 30 Jul 2011 12:40:05 +0000 (13:40 +0100)
Signed-off-by: Stephen Gran <steve@lobefin.net>
dsa-nagios-checks/checks/dsa-check-raid-megactl

index ae7a78c..da6a6f2 100755 (executable)
@@ -10,6 +10,10 @@ my @ok;
 
 my @cmd = ('sudo', 'megactl', '-Hv', '2>&1');
 my @output = `@cmd`;
+if ($? != 0) {
+       print "WARNING: Exec failed!\n";
+       exit 2;
+}
 
 for my $line (@output) {
        if ($line =~ /^(\w+)\s+/) {