#!/bin/bash

master='wmc-admin01d'
runhost=`hostname -s`

if [ "$master" != "$runhost" ]; then
    exit 0
fi

cd /var/lib/yandex/webmaster/wmc-logs
rsync *.total wmcuser@wmc-admin01g.search.yandex.net::wmc-logs/
if [ $? -ne 0 ]; then
    echo "Error sync $1 data!" 1>&2
    exit 1
fi

rsync *.total wmcuser@wmc-admin01h.search.yandex.net::wmc-logs/
if [ $? -ne 0 ]; then
    echo "Error sync $1 data!" 1>&2
    exit 1
fi

exit 0
