On Mon, Mar 20, 2000 at 10:36:40AM -0800, [EMAIL PROTECTED] wrote:
> while true
> do
>  sleep 3
>  if [ -n "`cat $RAID_STAT | perl -ne 'if (/(.*\[U*[^\]\[U]+U*\])$/) { print 
>\"Failure! $1\n\"; }'`" ]
>  then
>         cat $RAID_STAT | mail -s "**** Raid Failure Warning ****" $ADMIN_EMAIL
>         sleep 600
>  fi
> done

Ugh.  Why would you want to check every _3 seconds_ for a disk failure?
That's a lot of wasted cycles.  Instead of forking a few different programs
like that, how about:

a cronjob that runs every 5 minutes and just diffs mdstat and a copy of a
good mdstat:

*/5 * * * * /usr/bin/diff /mdstat.good /proc/mdstat

Just do "cp /proc/mdstat /mdstat.good", and that's it.  You'll get a mail if
there's a difference (including failure), and no mail if they're the same.
You still get mailed every 5 minutes, but you don't use quite so many cycles
and processes to do it.  (worst case, you have a 5-10 minute window with a
failed disk.  If you're worried about it, change the */5 to * ...)  You could
also throw this into a monitor using "mon"
(http://www.kernel.org/software/mon) which you can set to mail you once an
hour/etc.

-- 
Randomly Generated Tagline:
I'd love to, but I want to spend more time with my blender.

Reply via email to