zoukankan      html  css  js  c++  java
  • 远程Release用Bactch处理

    chcp 932
    @echo off
    echo ##############################################################
    echo SRC must be copyed into "PROJECTA" .Has it already been copyed?
    echo Y.Yes
    echo N.No
    echo ##############################################################
    echo.
    rmdir /s/q PROJECTA
    xcopy "../PROJECTA" "PROJECTA" /EXCLUDE:ReleaseExclude.txt /e /h /i /y
    rmdir "PROJECTA/PROJECTA_Frame/PROJECTA_Frame/WebSite/Log" /s /q
    echo %date% %time% --------------------------192.168.1.101 Release Begin----------------------------------------->>log.txt
    net use \192.168.1.101C$inetpubwwwroot /USER:sadmin S3300625!
    if %ERRORLEVEL% EQU 0 (echo %date% %time% Access to the server:192.168.1.101>>log.txt ) else (echo %date% %time% Failed to Access the server:192.168.1.101>>log.txt)
    sc \192.168.1.101 stop W3SVC
    if %ERRORLEVEL% EQU 0 (echo %date% %time% The IIS services has been shutted down at 192.168.1.101>>log.txt ) else (echo %date% %time% Failed to shutted down the IIS services at 192.168.1.101.>>log.txt)
    copy "\192.168.1.101C$inetpubwwwrootPROJECTA_TESTPROJECTA_FramePROJECTA_FrameWebSiteConfDB.xml" "PROJECTA/PROJECTA_Frame/PROJECTA_Frame/WebSite/Conf/" /y
    if %ERRORLEVEL% EQU 0 (echo %date% %time% DB.xml was copied.>>log.txt ) else (echo %date% %time% Failed to copy DB.xml.>>log.txt)
    copy "\192.168.1.101C$inetpubwwwrootPROJECTA_TESTPROJECTA_FramePROJECTA_FrameWebSiteConfSetting.xml" "PROJECTA/PROJECTA_Frame/PROJECTA_Frame/WebSite/Conf/" /y
    if %ERRORLEVEL% EQU 0 (echo %date% %time% Setting.xml was copied.>>log.txt ) else (echo %date% %time% Failed to copy Setting.xml.>>log.txt)
    copy "\192.168.1.101C$inetpubwwwrootPROJECTA_TESTPROJECTA_FramePROJECTA_FrameWebSiteimghead_title.jpg" "PROJECTA/PROJECTA_Frame/PROJECTA_Frame/WebSite/img/" /y
    if %ERRORLEVEL% EQU 0 (echo %date% %time% head_title.jpg was copied.>>log.txt ) else (echo %date% %time% Failed to copy head_title.jpg.>>log.txt)
    copy "\192.168.1.101C$inetpubwwwrootPROJECTA_TESTPROJECTA_FramePROJECTA_FrameWebSiteWebFrontA15AplicationGA01102.aspx" "PROJECTA/PROJECTA_Frame/PROJECTA_Frame/WebSite/WebFront/A15Aplication/" /y
    if %ERRORLEVEL% EQU 0 (echo %date% %time% GA01102.aspx was copied.>>log.txt ) else (echo %date% %time% Failed to copy GA01102.aspx.>>log.txt)
    xcopy "\192.168.1.101C$inetpubwwwrootPROJECTA_TESTPROJECTA_FramePROJECTA_FrameWebSiteLog" "PROJECTA/PROJECTA_Frame/PROJECTA_Frame/WebSite/Log" /e /h /i /y
    if %ERRORLEVEL% EQU 0 (echo %date% %time% Log was copied.>>log.txt ) else (echo %date% %time% Failed to copy Log.>>log.txt)
    pushd "\192.168.1.101C$inetpubwwwroot"
    FOR /d %%i IN (PROJECTA_OLD/PROJECTA_TEST_20*) DO rmdir "PROJECTA_OLD/%%i" /s /q
    if %ERRORLEVEL% EQU 0 (echo %date% %time% The backup of PROJECTA_TEST was deleted.>>log.txt ) else (echo %date% %time% Failed to deleted the backup of PROJECTA_TEST.>>log.txt)
    FOR /d %%i IN (PROJECTA_TEST_20*) DO move %%i PROJECTA_OLD
    if %ERRORLEVEL% EQU 0 (echo %date% %time% The file was backuped up.>>log.txt ) else (echo %date% %time% Failed to backup up the file.>>log.txt)
    set curtime=%time:~0,2%%time:~3,2%
    setlocal enabledelayedexpansion
    set curtime=!curtime: =0!
    setlocal disabledelayedexpansion
    ren "PROJECTA_TEST" PROJECTA_TEST_%date:~0,4%%date:~5,2%%date:~8,2%%curtime%
    if %ERRORLEVEL% EQU 0 (echo %date% %time% The file was renamed.>>log.txt ) else (echo %date% %time% Failed to renamed the file.>>log.txt)
    popd
    xcopy "PROJECTA" "\192.168.1.101C$inetpubwwwrootPROJECTA_TEST" /EXCLUDE:ReleaseExclude.txt /e /h /i /y
    if %ERRORLEVEL% EQU 0 (echo %date% %time% Web file was copied to 192.168.1.101 as PROJECTA_TEST successfully!.>>log.txt ) else (echo %date% %time% Failed to copy Web file to 192.168.1.101 as PROJECTA_TEST.>>log.txt)
    icacls "\192.168.1.101C$inetpubwwwrootPROJECTA_TESTPROJECTA_FramePROJECTA_FrameWebSitelog" /grant BUILTINIIS_IUSRS:(OI)(CI)(M,W) /t /q
    sc \192.168.1.101 start W3SVC
    if %ERRORLEVEL% EQU 0 (echo %date% %time% The IIS services was restarted at 192.168.1.101.>>log.txt ) else (echo %date% %time% Failed to restarted the IIS services at 192.168.1.101.>>log.txt)
    net use \192.168.1.101C$inetpubwwwroot /del /y
    if %ERRORLEVEL% EQU 0 (echo %date% %time% Disconnect to the server:192.168.1.101.>>log.txt ) else (echo %date% %time% Failed to disconnect to the server:192.168.1.101.>>log.txt)
    rmdir "PROJECTA/PROJECTA_Frame/PROJECTA_Frame/WebSite/Log" /s /q
    md "PROJECTA/PROJECTA_Frame/PROJECTA_Frame/WebSite/Log"
    zip PROJECTA_%date:~0,4%%date:~5,2%%date:~8,2%%curtime% "PROJECTA" -r
    move PROJECTA_%date:~0,4%%date:~5,2%%date:~8,2%%curtime%.zip "zip"
    echo.
    echo PROJECTA be Released in Server:192.168.1.101 successfully!
    echo.
    pause
    echo %date% %time% --------------------------192.168.1.101 Realse End----------------------------------------->>log.txt
    ren "log.txt" log_%date:~0,4%%date:~5,2%%date:~8,2%%curtime%.txt
    Love it, and you live without it
  • 相关阅读:
    结构化数据上的 TopN 运算
    Excel 分组后计算
    主流开源 BI 产品对比
    职场人员该学什么程序语言
    Python 并不合适职场编程,SPL 才行
    v-if 和 v-show 到底有什么区别 何时用v-if 何时用v-show
    APP 在退出登录 页面 注意事项
    APP 项目,登录注册页面,注意事项
    input 文本内容 ,才用正则过滤后,内容没有实时更新 的 处理方法
    实现 长按复制粘贴文本
  • 原文地址:https://www.cnblogs.com/tomclock/p/7682106.html
Copyright © 2011-2022 走看看