34 lines
940 B
Batchfile
34 lines
940 B
Batchfile
|
|
@echo off
|
||
|
|
setlocal EnableExtensions EnableDelayedExpansion
|
||
|
|
|
||
|
|
set "SCRIPT_DIR=%~dp0"
|
||
|
|
set "SERVER_HOST=116.62.17.81"
|
||
|
|
set "SERVER_PORT=9444"
|
||
|
|
set "SERVER_USERNAME=wkc"
|
||
|
|
set "SERVER_PASSWORD=wkc@0825"
|
||
|
|
set "REMOTE_ROOT=/volume1/webapp/ccdi"
|
||
|
|
set "DRY_RUN="
|
||
|
|
set /a POSITION=0
|
||
|
|
|
||
|
|
:parse_args
|
||
|
|
if "%~1"=="" goto run_script
|
||
|
|
|
||
|
|
if /I "%~1"=="--dry-run" (
|
||
|
|
set "DRY_RUN=-DryRun"
|
||
|
|
) else (
|
||
|
|
set /a POSITION+=1
|
||
|
|
if !POSITION!==1 set "SERVER_HOST=%~1"
|
||
|
|
if !POSITION!==2 set "SERVER_PORT=%~1"
|
||
|
|
if !POSITION!==3 set "SERVER_USERNAME=%~1"
|
||
|
|
if !POSITION!==4 set "SERVER_PASSWORD=%~1"
|
||
|
|
if !POSITION!==5 set "REMOTE_ROOT=%~1"
|
||
|
|
)
|
||
|
|
|
||
|
|
shift
|
||
|
|
goto parse_args
|
||
|
|
|
||
|
|
:run_script
|
||
|
|
powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%deploy.ps1" -ServerHost "%SERVER_HOST%" -Port "%SERVER_PORT%" -Username "%SERVER_USERNAME%" -Password "%SERVER_PASSWORD%" -RemoteRoot "%REMOTE_ROOT%" %DRY_RUN%
|
||
|
|
set "EXIT_CODE=%ERRORLEVEL%"
|
||
|
|
endlocal & exit /b %EXIT_CODE%
|