一个 rsync同步文件脚本

#/bin/bash

cd /root/phone

echo "update guanwang phone version"

git pull

if [ $? -ne 0 ]; then
        echo "update guanwang phone version from git failed"
        exit 1
fi

rsync -avzP --delete /root/phone *.*.*.*:/data/website/company/

if [ $? -ne 0 ]; then
        echo "rsync phone dir failed"
        exit 1
fi

echo "phone update success"

cd /root/web

echo "update guanwang web version"

git pull

if [ $? -ne 0 ]; then
        echo "update guanwang web version from git failed"
        exit 1
fi

rsync -avzP --delete /root/web *.*.*.*:/data/website/company/

if [ $? -ne 0 ]; then
        echo "rsync web dir failed"
        exit 1
fi

echo "web update success"

 

posted @ 2017-11-09 15:48  Oops!#  阅读(693)  评论(0编辑  收藏  举报