基本shell编程【2】-服务端发布脚本
2015-07-22 09:41
567 查看
set -x deployBase="/var/lib/tomcat7/webapps" bakBase="/root/bak" echo "autoconfig..." cp /root/youqu-config/config-test.properties /root/youqu/src/main/resources/config.properties echo "pull?" read pull if [ $pull = 'yes' ] then echo "pulling..." && cd ~/youqu/ && git pull 1>&1 && cd ~ fi cp ${deployBase}/youqu.war ${bakBase}/youqu_bak_$(date "+%Y%m%d_%H_%M").war rm -rf ${deployBase}/youqu* ant service tomcat7 stop cp AntBuild/war/youqu.war ${deployBase} service tomcat7 start set +x
以上脚本实现了简单的git pull ->备份 ->服务器重新启动的流程,供参考。
上文中配置是通过config文件的整体替换来实现的,更聪明的方式是内容替换,一个很好的工具是sed。在下一篇中涉及
相关文章推荐
- hbase常用的shell命令例子
- shell获取IP地址
- shell 之点滴记录
- Mysql 查询注意和执行shell命令
- 计算100以内所有奇数的和以及所有偶数的和
- 03 bash特性
- Linux下常用的shell命令记录1
- 学习笔记(十一)——Linux Shell 基础知识
- shell步步进阶--- >/dev/null 2>&1
- mysql dump shell 脚本crontab 计划任务
- shell步步进阶---测试文件是否存在的2种shell写法
- root后adb shell默认不是root用户时,如何将文件放入手机系统中
- Exchange的PowerShell中关于Filter的写法
- 利用xshell密钥管理服务器远程登录+VIM dd命令操作之伤之再伤
- shell中curl 用户详解
- iOS工程自动打包 (Shell脚本打包)
- shell——判断文件是否存在
- 在Qt creator中选择了dark配色方案编写shell,某些命令为深紫色很难看清楚的解决方法
- linux shell if 参数
- Lync 2013常用Powershell总结