File Name :mla-generate-appversion.bat
@echo off
setLocal EnableDelayedExpansion
rem This Bat file is used to generate a Environment specific Versions file and copies the generated file into the 110 deployment server
set TargetServer=APPIN014DEV111.APPDEV.CORPTST.ANZ.COM
set path=%1
set Envname=%2
set Flag=%3
set "comma=,"
IF %Flag% == GenerateVersion (goto :AppVersions)
IF %Flag% == EVMDBversion (goto :EVMDB)
IF %Flag% == TRNDBversion (goto :TRNDB)
:AppVersions
IF EXIST %path%\target\%Envname%\MLA\App-Version-Details.txt del %path%\target\%Envname%\MLA\App-Version-Details.txt
IF EXIST %path%\target\%Envname%\MLA\App-DBVer-Details.txt del %path%\target\%Envname%\MLA\App-DBVer-Details.txt
IF EXIST %path%\target\%Envname%\MLA\%Envname%-LFApp-Version-Details.txt del %path%\target\%Envname%\MLA\%Envname%-LFApp-Version-Details.txt
rem Iterates through the list of Version files generated in the deployment server and generates a env specific applications sheet
set LF_ver_Details="%path%\target\%Envname%\MLA\LF-AppDetails.txt"
for /f "eol= tokens=* delims= usebackq" %%i in (%LF_ver_Details%) do (
echo %%i >> %path%\target\%Envname%\MLA\App-Version-Details.txt
)
for /f "delims=" %%l in (%path%\target\%Envname%\MLA\Lendfast\LF-RIOdb-versiondtls.txt) Do (
echo %%l %comma% >> %path%\target\%Envname%\MLA\App-Version-Details.txt
)
set DB_rpt_ver_Details="%path%\target\%Envname%\MLA\Lendfast\LF-rptdb-versiondtls.txt"
for /f "eol= tokens=* delims= usebackq" %%i in (%DB_rpt_ver_Details%) do (
echo %%i %comma% >> %path%\\target\%Envname%\MLA\App-Version-Details.txt
)
for /f "delims=" %%l in (%path%\target\%Envname%\MLA\Lendfast\LF-db-versiondtls.txt) Do (
echo %%l %comma% >> %path%\target\%Envname%\MLA\App-Version-Details.txt
)
if exist %path%\target\%Envname%\MLA\App-DBVer-Details.txt del %path%\target\%Envname%\MLA\App-DBVer-Details.txt
if exist %path%\target\%Envname%\MLA\App-DBVer-Details.txt del %path%\target\%Envname%\MLA\LF-RIOdb-versiondtls.txt
)
set SM_ver_Details="%path%\target\%Envname%\MLA\SM-AppDetails.txt"
for /f "eol= tokens=* delims= usebackq" %%i in (%SM_ver_Details%) do (
echo %%i >> %path%\target\%Envname%\MLA\App-Version-Details.txt
)
for /f "delims=" %%l in (%path%\target\%Envname%\MLA\StrategyManager\SM-db-versiondtls.txt) Do (
echo %%l %comma% >> %path%\target\%Envname%\MLA\App-Version-Details.txt
)
set DMS_ver_Details="%path%\target\%Envname%\MLA\DMS-AppDetails.txt"
for /f "eol= tokens=* delims= usebackq" %%i in (%DMS_ver_Details%) do (
echo %%i >> %path%\target\%Envname%\MLA\App-Version-Details.txt
)
set Batch_ver_Details="%path%\target\%Envname%\MLA\Batch-versions-list.txt"
for /f "eol= tokens=* delims= usebackq" %%i in (%Batch_ver_Details%) do (
echo %%i >> %path%\target\%Envname%\MLA\App-Version-Details.txt
sleep 2
)
set TH_ver_Details="%path%\target\%Envname%\MLA\TH-AppDetails.txt"
for /f "eol= tokens=* delims= usebackq" %%i in (%TH_ver_Details%) do (
echo %%i >> %path%\target\%Envname%\MLA\App-Version-Details.txt
)
set WSS_ver_Details="%path%\target\%Envname%\MLA\wss-version.txt"
for /f "eol= tokens=* delims= usebackq" %%i in (%WSS_ver_Details%) do (
echo %%i >> %path%\target\%Envname%\MLA\App-Version-Details.txt
)
echo ^<^/Versions^> >> %path%\target\%Envname%\MLA\App-Version-Details.txt
set App_ver_Details="%path%\target\%Envname%\MLA\App-Version-Details.txt"
for /f "eol= tokens=* delims= usebackq" %%i in (%App_ver_Details%) do (
echo %%i >> %path%\target\%Envname%\MLA\%Envname%-LFApp-Version-Details.txt
)
IF EXIST %path%\target\%Envname%\MLA\LF-AppDetails.txt del %path%\target\%Envname%\MLA\LF-AppDetails.txt
IF EXIST %path%\target\%Envname%\MLA\SM-AppDetails.txt del %path%\target\%Envname%\MLA\SM-AppDetails.txt
IF EXIST %path%\target\%Envname%\MLA\DMS-AppDetails.txt del %path%\target\%Envname%\MLA\DMS-AppDetails.txt
IF EXIST %path%\target\%Envname%\MLA\App-DBVer-Details.txt del %path%\target\%Envname%\MLA\App-DBVer-Details.txt
IF EXIST %path%\target\%Envname%\MLA\App-Version-Details.txt del %path%\target\%Envname%\MLA\App-Version-Details.txt
IF EXIST %path%\target\%Envname%\MLA\LF-db-versiondtls-list.txt del %path%\target\%Envname%\MLA\LF-db-versiondtls-list.txt
IF EXIST %path%\target\%Envname%\MLA\SM-db-versiondtls-list.txt del %path%\target\%Envname%\MLA\SM-db-versiondtls-list.txt
IF EXIST %path%\target\%Envname%\MLA\Batch-versions-list.txt del %path%\target\%Envname%\MLA\Batch-versions-list.txt
IF EXIST %path%\target\%Envname%\MLA\wss-version.txt del %path%\target\%Envname%\MLA\wss-version.txt
if exist Z: (net use Z: /delete)
Echo net Z: \\%TargetServer%\d$\/user:appdev\cruiseuser cruisepwd
c:\WINDOWS\system32\net.exe use Z: \\%TargetServer%\d$ /user:appdev\aumlacsv Ev*luti*n09
Echo Xcopy %path%\target\%Envname%\MLA\%Envname%-LFApp-Version-Details.txt /Y %Drive% \\%TargetServer%\d$\App-Versions\%Envname%\
c:\WINDOWS\system32\xcopy.exe %path%\target\%Envname%\MLA\%Envname%-LFApp-Version-Details.txt /Y %Drive% \\%TargetServer%\d$\App-Versions\%Envname%\
if exist Z: (net use Z: /delete)
goto :end
: EVMDB
set DB_ref_ver_Details="%path%\target\%Envname%\MLA\Lendfast\LF-db-refdtls.txt"
for /f "eol= tokens=* delims= usebackq" %%i in (%DB_ref_ver_Details%) do (
echo %%i >> %path%\target\%Envname%\MLA\Lendfast\LF-db-versiondtls.txt
)
set DB_stub_ver_Details="D:\Apps\App-Version-Stub\LF-stub-refdtls.txt"
for /f "eol= tokens=* delims= usebackq" %%i in (%DB_stub_ver_Details%) do (
echo %%i >> %path%\target\%Envname%\MLA\Lendfast\LF-db-versiondtls.txt
)
set DB_sche_ver_Details="%path%\target\%Envname%\MLA\Lendfast\LF-db-schemadtls.txt"
for /f "eol= tokens=* delims= usebackq" %%i in (%DB_sche_ver_Details%) do (
echo %%i >> %path%\target\%Envname%\MLA\Lendfast\LF-db-versiondtls.txt
)
IF EXIST %path%\target\%Envname%\MLA\Lendfast\LF-db-refdtls.txt del %path%\target\%Envname%\MLA\Lendfast\LF-db-refdtls.txt
IF EXIST %path%\target\%Envname%\MLA\Lendfast\LF-db-schemadtls.txt del %path%\target\%Envname%\MLA\Lendfast\LF-db-schemadtls.txt
goto :end
:TRNDB
set DB_TRN_TMver_Details="%path%\target\%Envname%\MLA\Lendfast\LF-TRN-TMdbversions.txt"
for /f "eol= tokens=* delims= usebackq" %%i in (%DB_TRN_TMver_Details%) do (
echo %%i >> %path%\target\%Envname%\MLA\Lendfast\LF-db-versiondtls.txt
)
set DB_TRN_ver_Details="%path%\target\%Envname%\MLA\Lendfast\LF-TRN-dbversions.txt"
for /f "eol= tokens=* delims= usebackq" %%i in (%DB_TRN_ver_Details%) do (
echo %%i >> %path%\target\%Envname%\MLA\Lendfast\LF-db-versiondtls.txt
)
set DB_TRN_ver_Details="%path%\target\%Envname%\MLA\Lendfast\LF-TMSchema-versions.txt"
for /f "eol= tokens=* delims= usebackq" %%i in (%DB_TRN_ver_Details%) do (
echo %%i >> %path%\target\%Envname%\MLA\Lendfast\LF-db-versiondtls.txt
)
set DB_ref_ver_Details="%path%\target\%Envname%\MLA\Lendfast\LF-db-refdtls.txt"
for /f "eol= tokens=* delims= usebackq" %%i in (%DB_ref_ver_Details%) do (
echo %%i >> %path%\target\%Envname%\MLA\Lendfast\LF-db-versiondtls.txt
)
set DB_sample_ver_Details="%path%\target\%Envname%\MLA\Lendfast\LF-db-sampleversions.txt"
for /f "eol= tokens=* delims= usebackq" %%i in (%DB_sample_ver_Details%) do (
echo %%i >> %path%\target\%Envname%\MLA\Lendfast\LF-db-versiondtls.txt
)
set DB_sche_ver_Details="%path%\target\%Envname%\MLA\Lendfast\LF-db-schemadtls.txt"
for /f "eol= tokens=* delims= usebackq" %%i in (%DB_sche_ver_Details%) do (
echo %%i >> %path%\target\%Envname%\MLA\Lendfast\LF-db-versiondtls.txt
)
IF EXIST %path%\target\%Envname%\MLA\Lendfast\LF-db-refdtls.txt del %path%\target\%Envname%\MLA\Lendfast\LF-db-refdtls.txt
IF EXIST %path%\target\%Envname%\MLA\Lendfast\LF-db-sampleversions.txt del %path%\target\%Envname%\MLA\Lendfast\LF-db-sampleversions.txt
IF EXIST %path%\target\%Envname%\MLA\Lendfast\LF-db-schemadtls.txt del %path%\target\%Envname%\MLA\Lendfast\LF-db-schemadtls.txt
IF EXIST %path%\target\%Envname%\MLA\Lendfast\LF-TRN-dbversions.txt del %path%\target\%Envname%\MLA\Lendfast\LF-TRN-dbversions.txt
IF EXIST %path%\target\%Envname%\MLA\Lendfast\LF-TRN-TMdbversions.txt del %path%\target\%Envname%\MLA\Lendfast\LF-TRN-TMdbversions.txt
goto :end
:end
No comments:
Post a Comment
Do not post irrelevant comments, please!