rsync实现站点更新

更新脚本为rsync.sh
 内容如下:
#!/bin/bash


projectRootPath=/server/wwwTest    //服务器目录
localPath=/var/www/html/www.ss.com/ss.com/*     //本地目录
syncPath=${projectRootPath}/www.ss.com/

rsyncProg=/usr/bin/rsync
rsyncParameters="-avzrq --progress -e ssh"
publicServer=x.x.x.x        // x.x.x.x  为服务器IP
rsyncUser=rsync

rsyncExcludeParams='--exclude "config.php" --exclude "uploads" --exclude ".svn" --exclude "config" --exclude "cache" --exclude "logs" --exclude "update.sh" --exclude "qx.sh" --exclude ".git" --exclude "statics"'

execCmd="${rsyncProg} ${rsyncParameters} ${localPath} ${rsyncUser}@${publicServer}:${syncPath}"
echo $execCmd

#su - ${rsyncUser} -c "${execCmd}"
exec $execCmd --exclude-from="exclude.list"

[ "$?" == "0" ]&& echo "update finish !"
echo $?





exclude.list文件里面写你要忽略的文件或目录(即不上传的东西,一行一个,前面加#为注释)
.svn
config
cache
logs
update.sh
#qx.sh
.git
statics
exclude.list
#test

你可能感兴趣的:(web服务器)