#!/bin/sh

homedir=/usr/local/pub/homes/boris
webdir=/usr/local/pub/homes/boris/public_html
bmdir=/usr/local/pub/homes/boris/mirror
mdir=/usr/local/pub/mirror2.3
mfile=.mirror

/bin/rm -rf $bmdir/mirrored_html/$mfile
/bin/rm -rf $webdir/gifs/$mfile

cd $mdir

./volc_mirror.pl

cd $bmdir/mirrored_html 

if [ "`grep Got $mfile`" != "" ]; then
    convert="`grep Got $mfile | awk '{print $2}'`"

    for i in $convert; do
	tr '\015' '\012' < $i | \
	sed -e "s/http:\/\/www\.geomar\.de\/personal\/bbehncke/\/~boris/g" \
	-e "s/ftp:\/\/www\.geomar\.de\/pub\/mac\/bbehncke\/WWW/\/~boris/g" \
	> $webdir/$i
    done
    echo $convert | mail mtdolan
fi
