系统发布主目录:E:\HRM_Deploy\HOL_Deploy
文件夹:
E:\HRM_Deploy\HOL_Deploy\download 存放下载的发布程序
E:\HRM_Deploy\HOL_Deploy\nant 存放nant构建程序
E:\HRM_Deploy\HOL_Deploy\temp 存放解压的发布程序
1.0 修改download.ftp文件的版本
1.1 备份清理解压
1) 执行备份清理解压批处理程序:1-备份清理解压-build.xml.bat
2) 备份文件存储路径:E:\HRM_App_Bak\HOL_App_Bak (对应build.xml中的zip 功能)
3) 清理文件存储路径:E\HRM_Deploy\HOL_Deploy\temp (对应build.xml中的clean 功能)
4) 下载与解压发布文件存储路径:E\HRM_Deploy\HOL_Deploy\temp (对应build.xml mkdir与get 功能,上次发布的文件,或本次解压的发布文件 的存储目录)
@Echo off .\nant\bin\nant.exe -buildfile:build.xml zip clean mkdir get unzip -l:deploy.log1 pause
1.2 发布升级程序
1) 执行备份清理解压批处理程序:2-发布升级程序-build.xml.bat
@echo off echo. │──────────────────────────────────│ echo. │ 开始部署 echo. │──────────────────────────────────│ echo. │ 请看清楚是否继续部署!!!!!!!! echo. │──────────────────────────────────│ echo. │ │ echo. │──────────────────────────────────│ echo. set /p choice=请选择是否继续部署(y/n)?: echo %choice% if %choice%==y (echo 你输入的为y iisreset -stop .\nant\bin\nant.exe -buildfile:build.xml copy_HROnlineweb copy_HROnline2008web copy_SalarySystemweb -l:deploy.log2 iisreset -start ) else (echo 退出部署!! ) echo ..............................应用部署完成................................ pause>nul
在
.\nant\bin\nant.exe -buildfile:build.xml copy_HROnlineweb copy_HROnline2008web copy_SalarySystemweb -l:deploy.log2
中 copy_HROnlineweb
copy_HROnline2008web
copy_SalarySystemweb
是需要发布的三个应用
1.3 重启应用服务
在cmd中:iisreset -start,通常发布升级程序中会包含此步骤。
1.4 公共文件
<?xml version="1.0" encoding="gb2312"?> <project name="TMS_Deploy" default="all"> <property name="root.dir" value="${directory::get-current-directory()}\..\.." /> <!-- define envionmentvariables information --> <property name="EnvionmentVariables" value="EnvionmentVariables.xml" /> <property name="nowTime" value="${datetime::get-year(datetime::now())}-${datetime::get-month(datetime::now())}-${datetime::get-day(datetime::now())}"/> <property name="nowTime1" value="${datetime::get-year(datetime::now())}-${datetime::get-month(datetime::now())}-${datetime::get-day(datetime::now())}-${datetime::get-hour(datetime::now())}"/> <property name="HROnline.dir" value="E:\WebSite\HROnline" /> <property name="HROnline2008.dir" value="E:\WebSite\HROnline2008" /> <property name="SalarySystem.dir" value="E:\WebSite\SalarySystem" /> <property name="Sqlplus.dir" value="D:\oracle\product\10.2.0\client_1\BIN\Sqlplus.exe" /> <property name="work.dir" value="E:\HRM_Deploy\HOL_Deploy" /> <property name="download.dir" value="${work.dir}\download" /> <property name="temp.dir" value="${work.dir}\temp" /> <property name="history.dir" value="E:\HRM_App_BAk\HOL_App_Bak\${nowTime}" /> <property name="releasedb.dir" value="${temp.dir}\DB" /> <target name="all" depends="zip,clean,mkdir,get,unzip,copy_HROnlineweb, copy_HROnline2008web, copy_SalarySystemweb,iisrest,mail"/> <!--备分应用--> <target name="zip"> <zip zipfile="${history.dir}\HROnlineweb-${nowTime1}.zip"> <fileset basedir="${HROnline.dir}" > <include name="**/*.*" /> <exclude name="**/*.log" /> <exclude name="**/*.pdb"/> <exclude name="**/LogFile/**"/> <exclude name="**/temp/**"/> <exclude name="**/.svn/**"/> <exclude name="**/_svn/**"/> <exclude name="**/.csproj**"/> <exclude name="**/.sln"/> <exclude name="**/log.**"/> <exclude name="**/.suo"/> <exclude name="**/Log/**"/> <exclude name="**/upload/**"/> <exclude name="**/Cn_HROnline/Jwhgz/AttachFile/**"/> <exclude name="**/Cn_HROnline/newupload/**"/> <exclude name="**/Cn_HROnline/Insurance/*xls"/> <exclude name="**/Cn_HROnline/ssolog/**"/> <exclude name="**/Cn_HROnline/HumanCost/*xls"/> <exclude name="**/Cn_HROnline/newemp/**"/> <exclude name="**/Cn_HROnline/SalaryNew/UI/DataImport/*xls"/> <exclude name="**/Cn_HROnline/SalaryNew/UI/SalaryDesign/excel/*xls"/> <exclude name="**/newupload/**"/> <exclude name="**/bbsupload/**"/> </fileset> </zip> <zip zipfile="${history.dir}\HROnline2008web-${nowTime1}.zip"> <fileset basedir="${HROnline2008.dir}" > <include name="**/*.*" /> <exclude name="**/*.log" /> <exclude name="**/*.cs" /> <exclude name="**/*.pdb"/> <exclude name="**/LogFile/**"/> <exclude name="**/temp/**"/> <exclude name="**/.svn/**"/> <exclude name="**/_svn/**"/> <exclude name="**/.csproj**"/> <exclude name="**/.sln"/> <exclude name="**/log.**"/> <exclude name="**/.suo"/> <exclude name="**/Log/**"/> <exclude name="**/upload/**"/> <exclude name="**/ssolog/**"/> <exclude name="**/temp/**"/> </fileset> </zip> <zip zipfile="${history.dir}\SalarySystemweb-${nowTime1}.zip"> <fileset basedir="${SalarySystem.dir}" > <include name="**/*.*" /> <exclude name="**/*.log" /> <exclude name="**/*.cs" /> <exclude name="**/*.pdb"/> <exclude name="**/LogFile/**"/> <exclude name="**/temp/**"/> <exclude name="**/.svn/**"/> <exclude name="**/_svn/**"/> <exclude name="**/.csproj**"/> <exclude name="**/.sln"/> <exclude name="**/log.**"/> <exclude name="**/.suo"/> <exclude name="**/Log/**"/> <exclude name="**/upload/**"/> </fileset> </zip> </target> <!--清除上一版本的临时文件--> <target name="clean"> <delete> <fileset> <include name="${temp.dir}/" /> </fileset> </delete> <delete> <fileset> <include name="${download.dir}/*.zip" /> </fileset> </delete> </target> <target name="mkdir"> <mkdir dir="${temp.dir}"/> </target> <!--下载并解压--> <target name="get"> <echo> ******************************</echo> <echo> fetch files</echo> <exec program="1_ftp.bat"> <arg value="/c" /> </exec> <echo> fetch zip finish </echo> </target> <target name="unzip"> <unzip zipfile="${download.dir}/HOL_App.zip" todir="${temp.dir}" overwrite="true" /> </target> <!--覆盖应用--> <target name="copy_HROnlineweb" > <copy todir="${HROnline.dir}" flatten="false" > <fileset basedir="${temp.dir}\HROnline"> <include name="**/*" /> <exclude name="**/*.log" /> <exclude name="**/*.pdb"/> <exclude name="**/LogFile/**"/> <exclude name="Config\SSB_Main.config"/> <exclude name="Config\FacilitiesConfig\sqlMap.config"/> <exclude name="web.config" /> <exclude name="**/.svn/**"/> <exclude name="**/_svn/**"/> </fileset> </copy> </target> <target name="copy_HROnline2008web" > <copy todir="${HROnline2008.dir}" flatten="false" > <fileset basedir="${temp.dir}\HROnline2008"> <include name="**/*" /> <exclude name="**/*.log" /> <exclude name="**/*.pdb"/> <exclude name="**/LogFile/**"/> <exclude name="Config\SSB_Main.config"/> <exclude name="Config\FacilitiesConfig\sqlMap.config"/> <exclude name="web.config" /> <exclude name="**/.svn/**"/> <exclude name="**/_svn/**"/> </fileset> </copy> </target> <target name="copy_SalarySystemweb" > <copy todir="${SalarySystem.dir}" flatten="false" > <fileset basedir="${temp.dir}\SalarySystem"> <include name="**/*" /> <exclude name="**/*.log" /> <exclude name="**/*.pdb"/> <exclude name="**/LogFile/**"/> <exclude name="web.config" /> <exclude name="**/.svn/**"/> <exclude name="**/_svn/**"/> </fileset> </copy> </target> <target name="iisrest"> <echo> ******************************</echo> <echo> Begin update </echo> <exec program="cmd"> <arg value="/c"/> <arg value="iisreset"/> </exec> <echo> update finish </echo> </target> <target name="mail" > <!-- <mail from="product_deploy@zte.com.cn" tolist="liu.jinjiao@zte.com.cn" subject="this is a test about fol_deploy!" mailhost="10.30.1.249"> <attachments> <include name="${work.dir}\fetch_log\*.txt" /> </attachments> </mail> --> </target> <!-- <target name="exec_database"> <exec program="${Sqlplus.dir}" commandline="rcs2/jie @RCS_TEST @install.sql" workingdir="${releasedb.dir}"/> </target> --> </project>
Buildfile: file:///E:/HRM_Deploy/HOL_Deploy/build.xml Target framework: Microsoft .NET Framework 3.5 Target(s) specified: zip clean mkdir get unzip zip: [zip] Zipping 34489 files to 'E:\HRM_App_BAk\HOL_App_Bak\2015-9-24\HROnlineweb-2015-9-24-17.zip'. [zip] Zipping 8316 files to 'E:\HRM_App_BAk\HOL_App_Bak\2015-9-24\HROnline2008web-2015-9-24-17.zip'. [zip] Zipping 3288 files to 'E:\HRM_App_BAk\HOL_App_Bak\2015-9-24\SalarySystemweb-2015-9-24-17.zip'. clean: [delete] Deleting 16628 files. [delete] Deleted 1279 directories. [delete] Deleting 2 files. mkdir: [mkdir] Creating directory 'E:\HRM_Deploy\HOL_Deploy\temp'. get: [echo] ****************************** [echo] fetch files [exec] [exec] E:\HRM_Deploy\HOL_Deploy>ftp -s:download.ftp 10.30.7.27 [exec] Connected to 10.30.7.27. [exec] [exec] 220 Serv-U FTP Server v10.5 ready... [exec] User (10.30.7.27:(none)): [exec] 331 User name okay, need password. [exec] [exec] 230 User logged in, proceed. [exec] ftp> cd /HOL/V10.3.2_P01/ [exec] 250 Directory changed to /HOL/V10.3.2_P01 [exec] ftp> get HOL100_V10.3.2_P01-应用.zip .\download\HOL_App.zip [exec] 200 PORT command successful. [exec] 150 Opening BINARY mode data connection for HOL100_V10.3.2_P01-应用.zip (4522 Bytes). [exec] 226 Transfer complete. 4,522 bytes transferred. 4.42 KB/sec. [exec] ftp: 4522 bytes received in 0.00Seconds 4522000.00Kbytes/sec. [exec] [exec] ftp> get HOL100_V10.3.2_P01-文档.zip .\download\HOL_Doc.zip [exec] 200 PORT command successful. [exec] 150 Opening BINARY mode data connection for HOL100_V10.3.2_P01-文档.zip (72426 Bytes). [exec] 226 Transfer complete. 72,426 bytes transferred. 70.73 KB/sec. [exec] ftp: 72426 bytes received in 0.02Seconds 4526.63Kbytes/sec. [exec] [exec] ftp> quit [exec] 221 Goodbye, closing session. [echo] fetch zip finish unzip: [unzip] Unzipping 'E:\HRM_Deploy\HOL_Deploy\download\HOL_App.zip' to 'E:\HRM_Deploy\HOL_Deploy\temp'. BUILD SUCCEEDED Total time: 1098 seconds.
Buildfile: file:///E:/HRM_Deploy/HOL_Deploy/build.xml Target framework: Microsoft .NET Framework 3.5 Target(s) specified: copy_HROnlineweb copy_HROnline2008web copy_SalarySystemweb copy_HROnlineweb: [copy] Copying 95 files to 'E:\WebSite\HROnline'. copy_HROnline2008web: [copy] Copying 59 files to 'E:\WebSite\HROnline2008'. copy_SalarySystemweb: BUILD SUCCEEDED Total time: 39.9 seconds.
hrm hrm168 cd /HOL/V10.3.2_P01/ get HOL100_V10.3.2_P01-应用.zip .\download\HOL_App.zip get HOL100_V10.3.2_P01-文档.zip .\download\HOL_Doc.zip quit