Ant脚本调用服务器端的shell发布
以下脚本为使用Ant脚本调用服务器端的shell发布应用程序的配置方式的备忘记录。
主要部分就是红色标记的.
运行时会替换变量,实际的命令是:
数据库发布命令:
<targetname="deploy_db">
<echomessage="ftptotestenv(${db.ftp.ip})of${project.name}"/>
<ftpserver="${db.ftp.ip}"
remotedir="${db.ftp.remote.dir}/${release.version.number}"
userid="${db.ftp.user}"
password="${db.ftp.pwd}"
action="mkdir">
</ftp>
<ftpserver="${db.ftp.ip}"
remotedir="${db.ftp.remote.dir}/${release.version.number}"
userid="${db.ftp.user}"
password="${db.ftp.pwd}"
>
<filesetdir="${release.package.dir}">
<includename="${release.version.number}.zip"/>
</fileset>
</ftp>
<echomessage="ftpend"/>
<echomessage="rundbscriptontestenv(${db.ftp.ip})of${project.name}"/>
<telnetuserid="${db.telnet.user}"password="${db.telnet.pwd}"server="${db.telnet.ip}">
<read>]</read>
<write>cd${db.ftp.remote.dir}</write>
<read>]</read>
<write>${db.telnet.rundb.cmd}${release.version.number}/${release.version.number}</write>
<read>]</read>
<write>exit</write>
</telnet>
<echomessage="dbscriptran"/>
</target>
${db.telnet.rundb.cmd}会替换成shauto_deploy_db.shupgradeGS32_DEV2GS32_DEV2pwd@o16710g11
${release.version.number}/${release.version.number}替换成20090615/20090615.zip
整条命令是shauto_deploy_db.shupgradeGS32_DEV2GS32_DEV2pwd@o16710g1120090615/20090615.zip
应用发布命令:
<telnetuserid="${app.telnet.user}"password="${app.telnet.pwd}"server="${app.telnet.ip}">
<read>]</read>
<write>cd${app.ftp.remote.dir}</write>
<read>]</read>
<write>${app.telnet.restrt.cmd}${release.version.number}/${release.version.number}main_dev</write>
<read>]</read>
<write>exit</write>
</telnet>
${app.telnet.restrt.cmd}${release.version.number}/${release.version.number}main_dev
替换后是:
shauto_deploy_app.sh20090615/20090615.zipmain_dev