@Echo off

REM ----------------------------------------------------------------------------
REM #Description: Script for purge fccCashe
REM #New: 21.09.2016 /J.Fes first version
REM #LUp: 07.02.2017 /J.Fes update to new version of TcPrompt_Custom.cmd
REM #LUp: 23.08.2021 /J.Fes using CmdCurRoot$_DP
REM ----------------------------------------------------------------------------

setlocal

rem --#toDo: setup default "#TcSiteId#"
set TcSiteId=

rem --#Doc: Check if P1 = TcSiteId is given by command line
if "%~1"        neq "" set TcSiteId=%~1
if "%~2"        neq "" set ProcessMode=%~2
if "%TcSiteId%" neq "" goto :Start


 rem #Doc: script section below is for check if Edit is done
 Echo ---------------------------------------------------------------------------
 Echo befor use please setup:
 Echo %0
 Echo after Return Edit of stript starts with Notepad
 pause
 start "Edit '%~0'" Notepad "%~0"

 exit
 Echo ---------------------------------------------------------------------------


:Start
 rem --#Doc: set path
 set CmdCurRoot$_DP=%~dp0
 set CmdCurRoot$_DP=%CmdCurRoot$_DP:~0,-1%
 set path=%CmdCurRoot$_DP%;%CmdCurRoot$_DP%\..\_CustomDefaults\TcPrompt;%CmdCurRoot$_DP%\..\_JobMgrDefaults;%path%
 @cd /d "%temp%"
 Echo ---------------------------------------------------------------------------
 Echo before get tc prompt for %TcSiteId%
 Call "%CmdCurRoot$_DP%\..\_CustomDefaults\TcPrompt\TcPrompt_Custom.cmd" "%TcSiteId%"
 Echo ---------------------------------------------------------------------------
 Echo FMS_HOME........................: %FMS_HOME%
 Echo ---------------------------------------------------------------------------
 Echo fcc status before purge on......: \\%ComputerName%
 call fccstat -config
 call fccstat -x
 Echo ---------------------------------------------------------------------------
 Echo fcc performe -clear on..........: \\%ComputerName%
 call fccstat -clear
 Echo fcc performe -purge on..........: \\%ComputerName%
 call fccstat -purge
 rem #New: 23.08.2021
 Echo fcc performe -restart on........: \\%ComputerName%
 call fccstat -restart
 Echo ---------------------------------------------------------------------------
 Echo fcc status after purge on.......: \\%ComputerName%
 call fccstat -config
 call fccstat -x
 if /I "%ProcessMode%" neq "BATCH" pause
endlocal
