Something along these lines if you're gonna do it in Perl.#!/usr/bin/perl -w use POSIX qw(strftime); my $raid_admin = "root@foo.bar"; my $raid_host = `/bin/hostname`; @ARGV = qw(/proc/mdstat); my @mdstat = <>; ## UNTESTED exit if not grep m{ \[(\d)/(\d)\] } && $1 ne $2, @mdstat; open( my $mail, "|/bin/mail -s 'RAID disk failure on $raid_host (". strftime('%Y.%m.%d-%H:%M'). ")' $raid_admin" ) or die "Couldn't spawn /bin/mail: $!\n"; print $mail @mdstat; close $mail;
Makeshifts last the longest.
In reply to Re: raid array checker (mdstat)
by Aristotle
in thread raid array checker (mdstat)
by ArtemZ1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |