shell简单的发布脚本
#!/bin/shcuruser=`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 "
exit
fi
hosts=$1
else
hosts="web10 web11 web12 web14web13"
fi
blackfile="bbs2ec_uc_20120221 webim ec_sites main.php config.inc.php cli.php runtime nbproject*.sh .svn *.log .*.swp uc2/data bbs2/forumdata attachments uc/datauc_client/data ec_uc spider_web chrome_news_tools doc cms/www cms/protected ucbusiness 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
页:
[1]