Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Dec 2006 09:57:21 -0800 (PST)
From:      "R. B. Riddick" <arne_woerner@yahoo.com>
To:        "R. B. Riddick" <arne_woerner@yahoo.com>, Christian Laursen <xi@borderworlds.dk>
Cc:        freebsd-geom@freebsd.org
Subject:   Re: geom_mirror delayed synchronizing question
Message-ID:  <507320.43622.qm@web30312.mail.mud.yahoo.com>
In-Reply-To: <20061227173527.18079.qmail@web30314.mail.mud.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--- "R. B. Riddick" <arne_woerner@yahoo.com> wrote:
> --- Christian Laursen <xi@borderworlds.dk> wrote:
> > No, -a and -n enables and disables autosynchronization. I want
> > autosynchronization but with a delay.
> >
> Then just issue "gmirror configure -a" by need (delayed; e. g. from
> /usr/local/etc/rc.d/gmirror-chk.sh) and disable it again, when sync is done
> (or
> started? I would have to test that...)...
> 
I have an even better idea (quick hack):

0. Turn off auto-sync: "gmirror configure -n <device name>"

1. we could schedule a gmirror-chk.sh execution every 5 minutes:
  */5 * * * * /root/gmirror-chk.sh
(note: crond is started after fsck)

2. /root/gmirror-chk.sh would look like this:
#!/bin/sh
gmirror status | grep / | cut -d/ -f2 | cut -d\  -f1 | \
while read dn ;do
  na=""
  fs=1
  gmirror list $dn | \
  while read ln ;do
    if [ `echo $ln | grep -c "^[1-9]"` -ne 0 ]; then
      if [ $fs -eq 1 ]; then
        fs=0
      else
        na=`echo $ln | cut -d\  -f3`
      fi
    elif [ ! -z "$na" ]; then
      if [ `echo $ln | grep -c "Flags: SYNCHRONIZING"` -ne 0 ]; then
        gmirror rebuild $dn $na
        break
      fi
    fi
  done
done

[TESTED OK R6.1]

-Arne

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?507320.43622.qm>