monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] Syncing databases without using a network?


From: Chad Walstrom
Subject: Re: [Monotone-devel] Syncing databases without using a network?
Date: Wed, 25 Jan 2006 15:34:32 -0600

Jeronimo Pellegrini wrote:
> Something like: monotone-sync databaseA.db databaseB.db

Christof Petig <address@hidden> wrote:
> here you are (untested) ...
> 
> --------------->8------------------
> #!/bin/sh
> monotone -d $1 serve --bind localhost serve \* &
> monotone -d $2 pull localhost \*
> kill %monotone
> ---------------------------------

Be careful with USB keys.  In my experience, you'll run in to integer
size problems with the database format.  For example, I cannot access
a monotone database (SQLite) on my amd64 Linux port that was created
on a i386 Linux port.  To synchronize, I needed to dump/read or make a
network connection between the two.  As a practice, I now dump and
compress monotone DB's to my USB key.

--------------->8------------------
#!/bin/sh
# NOT TESTED
# Dump databases
MTDIR=$HOME/.monotone
DATABASES=personal.db work.db
for i in $DATABASES ; do
    monotone -d $MTDIR/$i dump | bzip2 > ${i%db}sql.bz2
done
--------------->8------------------
#!/bin/sh
# NOT TESTED
# Dump databases
MTDIR=$HOME/.monotone

# Create the staging directory (assign default if not provided)
[ ! -d ${STAGEDIR:=/tmp/monotone-sync}  ] && mkdir -p $STAGEDIR || exit 1

# Load them to new databases
for i in *.sql.bz2; do
    bzip2 -cd $i | monotone -d $STAGEDIR/${i%sql.bz2}.db load
done

# Now synchronize them with local ones
for i in $STAGEDIR/*.db ; do
        if [ -f $MTDIR/$i ] ; then
                monotone -d $i serve --bind localhost serve \* &
                monotone -d $MTDIR/$i pull localhost \*
                kill %monotone
        else
                cp $i $MTDIR
        fi

        # Remove the DB
        rm $i
done
--------------->8------------------

Creating the db's in a memory resident filesystem would help speed
things up a bit.  i.e. tmpfs

I hadn't thought of this before, but it might be useful to store DB's
in arch-dependent directories or perhaps name them accordingly.

-- 
Chad Walstrom <address@hidden>           http://www.wookimus.net/
           assert(expired(knowledge)); /* core dump */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]