shell for循环 和 rsync同步 实例
来源:互联网 发布:命令行设置ip地址和mac 编辑:程序博客网 时间:2024/06/05 02:11
#!/bin/bash
#
# svn checkout to local dir
# used for upload to test env or online env
# local service : svn
# remote service : rsyncd
# write by bufy - 20150715
#
export PATH="/usr/bin:/bin:/usr/local/bin:/usr/local/subversion/bin/"
local_dir="/opt/php_new/"
remote_ip="101.37.1.79"
rsync_user="nobody"
rsync_mod="cc5"
###
if [ $1 ];then
if [ $1 == 'test' ];then
cd $local_dir
for dir in `ls`
do
cd $dir
echo $dir
svn up
cd ..
done
rsync -avzc --exclude ".svn" ${local_dir}/ ${rsync_user}@${remote_ip}::${rsync_mod}/test_dir/
elif [ $1 == 'online' ];then
cd $local_dir
for dir in `ls`
do
cd $dir
echo $dir
svn up
cd ..
done
rsync -avzc --exclude ".svn" ${local_dir}/ ${rsync_user}@${remote_ip}::${rsync_mod}/online_dir/
else
echo "璇疯緭鍏ユ纭寚浠[test|online]"
fi
else
echo "璇疯緭鍏ユ纭寚浠[test|online]"
fi
#
# svn checkout to local dir
# used for upload to test env or online env
# local service : svn
# remote service : rsyncd
# write by bufy - 20150715
#
export PATH="/usr/bin:/bin:/usr/local/bin:/usr/local/subversion/bin/"
local_dir="/opt/php_new/"
remote_ip="101.37.1.79"
rsync_user="nobody"
rsync_mod="cc5"
###
if [ $1 ];then
if [ $1 == 'test' ];then
cd $local_dir
for dir in `ls`
do
cd $dir
echo $dir
svn up
cd ..
done
rsync -avzc --exclude ".svn" ${local_dir}/ ${rsync_user}@${remote_ip}::${rsync_mod}/test_dir/
elif [ $1 == 'online' ];then
cd $local_dir
for dir in `ls`
do
cd $dir
echo $dir
svn up
cd ..
done
rsync -avzc --exclude ".svn" ${local_dir}/ ${rsync_user}@${remote_ip}::${rsync_mod}/online_dir/
else
echo "璇疯緭鍏ユ纭寚浠[test|online]"
fi
else
echo "璇疯緭鍏ユ纭寚浠[test|online]"
fi
0 0
- shell for循环 和 rsync同步 实例
- shell 中的for循环和while循环
- Mac OS X:升级rsync和同步应用实例
- Ubuntu rsync同步文件实例
- shell for循环和数组应用
- shell 之for循环和if
- 【shell编程学习】for 和 while循环
- Shell中的循环语句for、while、until实例讲解
- shell 中的for循环while循环和case语句
- shell循环:for循环、while循环、until循环和select循环
- Ubuntu下 rsync同步文件实例
- Ubuntu下 rsync同步文件实例
- shell循环1.for循环
- Shell For 循环
- shell for循环
- shell for循环语句
- shell for 循环
- shell脚本----for循环
- spring3之后各jar包相着依赖关系
- ab压力测试
- Mybatis3.2和Spring3.x整合----Mybtis3.x+Spring3.x
- Fresco图片库的基本使用
- 正则表达式中的?和?:
- shell for循环 和 rsync同步 实例
- POST中文乱码解决方案
- 有关JAVA语言的安卓手机软件开发的分析
- MySQL字段类型详解
- B+树原理及mysql的索引分析
- linux系统间通过cron和ssh实现数据的自动定时传输
- Java常量池相关问题
- 单片机--key
- 软开开发工具总结