[m-dev.] backup script

Peter Ross petdr at cs.mu.OZ.AU
Wed Nov 17 11:51:19 AEDT 1999


Here is a possibly useful script for backing up CVS archives, I will put
it in the tools directory if anyone thinks that it is useful.

#!/bin/sh

# Given a list of dirs, for each subdir in those dirs which is a CVS
# archive it produces a diff file that is compatible with cvspatch.
# Note that the diff file is a diff against the previous days compiler
# at midnight.

yesterday_date=`date --date "1 day ago" +"%Y-%m-%d"`
date=`date +"%Y-%m-%d"`
time="00:00:00"

cvsdate="$yesterday_date $time"

pwd=`pwd`

# delete all the backups over 7 days old
find . -name "*.diff.gz" -mtime +7 -exec 'rm {}' ';'

for dir in $@
do
    for subdir in `ls $dir`
    do
        if [ -d $dir/$subdir/CVS ]
        then
            (cd $dir/$subdir; cvs -f diff -D "$cvsdate" . 2>&1 |
                    gzip -9 > $pwd/$subdir-$date.diff.gz)
        fi
    done
done
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list