Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2809458
  • 博文数量: 587
  • 博客积分: 6356
  • 博客等级: 准将
  • 技术积分: 6410
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-23 10:54
个人简介

器量大者,福泽必厚

文章分类

全部博文(587)

文章存档

2019年(3)

2018年(1)

2017年(29)

2016年(39)

2015年(66)

2014年(117)

2013年(136)

2012年(58)

2011年(34)

2010年(50)

2009年(38)

2008年(16)

分类: LINUX

2009-06-19 14:01:48

下面的这个脚本,是从branches和trunk中都checkout项目, 而且从branches中checkout的脚本的目录已经写在一个文件中了, 我必须从branches下的目录(该文件中指定的!)去checkout

#!/bin/sh
for var in $@
do
pwd=~/project/
if [ -d ${pwd}/${var} ]; then
/bin/rm -fr ${pwd}/${var}
/bin/rm -fr ${pwd}/${var}_dev
fi
/usr/local/subversion/bin/svn checkout file:///home/svnsource/${var}/trunk ${pwd}/${var}
/bin/cat /home/l5m/project2/branches.properties| grep ${var} | grep -v grep | awk -F= '{ print $2 }' >${pwd}/${var}.txt
var_value=`/bin/cat ${pwd}/${var}.txt`
/usr/local/subversion/bin/svn checkout file:///home/svnsource/$var/branches/${var_value} ${pwd}/${var}_dev

/bin/sed "s/${var}/${var}_dev/g" ${pwd}/${var}_dev/build.xml >${pwd}/${var}_dev/build.xml.bak
/bin/mv -f ${pwd}/${var}_dev/build.xml.bak ${pwd}/${var}_dev/build.xml
/bin/rm -f ${pwd}/${var}.txt
done

一个从cvs repository中更新、编译、发布的shell脚本

cat update.sh

#!/bin/sh
. ~/.bashrc

cd ~/bin
echo "Your port is going to be shutdown,please waiting!!"
echo " "
echo " "
sh myshutdown.sh
sleep 60
#compile package common and customtags
for var in common customtags
do
cd ~/project/$var
cvs update -Ad
/home/ant/1.5.1/bin/ant clean 2>>~/project/error.log
/home/ant/1.5.1/bin/ant 2>>~/project/error.log
sleep 5
done

#compile package dot\dot2\intenal\rad\rem\loc\ttv
for var in internal auf dot dot2 rad rem loc ttv
do
cd ~/project/$var
cvs update -Ad
/home/ant/1.5.1/bin/ant clean 2>>~/project/error.log
/home/ant/1.5.1/bin/ant 2>>~/project/error.log
sleep 5
/home/ant/1.5.1/bin/ant deploy 2>>~/project/error.log
sleep 5
done

cd ~/bin
sh mystartup.sh

 

cvs中的ssh中端口的重定向!

xliu@qhtlnx25 ~/project$ cat ssh_cvs
#!/bin/sh
/usr/bin/ssh -p 2243 "$@"
xliu@qhtlnx25 ~/project$


svn 简单的脚本:
xliu@qhtlnx25 ~/project$ cat make_wars.sh  ##内容如下:
#!/bin/sh
. ~/.bashrc

cd ~/bin
echo "Your port is going to be shutdown,please waiting!!"
echo " "
echo " "
sh myshutdown.sh
sleep 10

#complile customtags and flextag
for var in common customtags flextag
do
cd ~/project/$var
/usr/local/subversion/bin/svn cleanup  ##这个是有好处的,防止文件被lock而不能被成功更新!
/usr/local/subversion/bin/svn -rHEAD update
/home/ant/1.5.1/bin/ant clean 2>>~/project/error.log
sleep 3
/home/ant/1.5.1/bin/ant 2>>~/project/error.log
sleep 5
done

#compile package auf\dot\dot2\intenal\ms2\rad\rem\loc\ttv
for var in $@
do
cd ~/project/$var
/usr/local/subversion/bin/svn cleanup
/usr/local/subversion/bin/svn update
/home/ant/1.5.1/bin/ant clean 2>>~/project/error.log
sleep 3
/home/ant/1.5.1/bin/ant deploy 2>>~/project/error.log
sleep 5
done

cd ~/bin
sh mystartup.sh


脚本的用途:

更新30的8080端口下的*.war(可以是package中的任意一个或几个),然后复制到31机器上,并在30上重启31的tomcat服务(443端口,tomcat下配置的https服务),

当然先要在30上的l5m用户和root(31机器)上打通无密码的ssh认证!

 

#!/bin/sh
for var in $@
do
echo "Begin to compile ${var} package"
sleep 5
su - l5m -c "~/project/make_wars.sh ${var} 2>~/project/error.log"
echo "Copying ${var}.war to 31 nys"
sleep 5
su - l5m -c "scp ~/mytc/webapps/${var}.war 2>~/project/error.log"
done
echo "restart 443 port in 31 nys"
sleep 5
su - l5m -c "ssh .* /home/*/bin/startAll /home/*/bin/nodes renew"


阅读(1295) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~