#!/bin/sh
curuser=`id -un`
echo "=== current user : $curuser ==="
if [ $curuser != "www" ];then
echo "please sudo -u www !"
exit
fi
if [ $# != 0 ];then
if [ $1 == "-h" ];then
echo "usage: $0 [host]"
exit
fi
hosts=$1
else
hosts="web10 web11 web12 web14 web13"
fi
blackfile="bbs2 ec_uc_20120221 webim ec_sites main.php config.inc.php cli.php runtime nbproject *.sh .svn *.log .*.swp uc2/data bbs2/forumdata p_w_uploads uc/data uc_client/data ec_uc spider_web chrome_news_tools doc cms/www cms/protected uc business lang bbs2/data"
blackstr=""
for file in $blackfile
do
blackstr=$blackstr" --exclude "$file
done
for i in $hosts
do
echo "----------${i}-----------"
rsync -r -avuz $blackstr www -e "ssh" ./ $i:/home/www/test/ &
done