:: ============================================================================ :: Copyright and license info is available in the LICENSE file included with :: the Server Deployment Package (SDP), and also available online: :: https://swarm.workshop.perforce.com/projects/perforce-software-sdp/view/main/LICENSE :: ---------------------------------------------------------------------------- @echo off set current_script_dir=%~p0 set SCRIPT_NAME=clean_replica.bat set SCRIPT_TASK=Clean Replica call %current_script_dir%p4env.bat %1 if errorlevel 1 ( echo %SCRIPT_TASK% aborted - invalid config file found. echo . exit /B 1 ) if x%SDP_INSTANCE% == x ( echo %SCRIPT_TASK% aborted - no instance parameter specified. echo . exit /B 1 ) set ORIG_DIR=%CD% set LOGFILE=checkpoint.log set LOG=%LOGS_DIR%\%LOGFILE% set JNL= set CKP= set OFF_JNL= cd /d "%LOGS_DIR%" :: Initialize the log file with a call to p4login. call %SCRIPTS_DIR%\p4login > %LOG% 2>&1 if not %ERRORLEVEL% EQU 0 goto ERROR date /t >> %LOG% time /t >> %LOG% echo Determining current journal counter with 'p4 counter journal'.>> %LOG% for /F %%F in ('%SDP_INSTANCE_BIN_DIR%\p4 counter journal') do (set JNL=%%F) if %JNL%x == x ( echo ERROR:>>%LOG% echo ERROR: Could not determine journal counter; JNL not set!>> %LOG% echo ERROR:>>%LOG% goto ERROR ) set /A CKP=JNL+1 if %CKP%x == x ( echo ERROR:>>%LOG% echo ERROR: Could not determine next checkpoint number; CKP not set!>>%LOG% echo ERROR:>>%LOG% goto ERROR ) echo Live checkpoint/journal numbers are %CKP%/%JNL%.>> %LOG% echo Start %SDP_INSTANCE_P4SERVICE_NAME% %SCRIPT_TASK%>> %LOG% echo .>> %LOG% set ERRORTEXT= goto SKIP_ERROR ::------------------------------------------------ :ERROR echo ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR >> %LOG% 2>&1 echo %SCRIPT_TASK% Failed >> %LOG% 2>&1 echo %SCRIPT_TASK% Failed - please see %LOG% echo . echo ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR >> %LOG% 2>&1 set ERRORTEXT=%SCRIPT_TASK% Failed! :SKIP_ERROR date /t >> %LOG% time /t >> %LOG% echo End %SDP_INSTANCE_P4SERVICE_NAME% %SCRIPT_TASK%>> %LOG% echo Checking Disk Space>> %LOG% %SDP_INSTANCE_BIN_DIR%\p4 diskspace >> %LOG% 2>&1 cd /d "%SCRIPTS_DIR%" if "%ERRORTEXT%x" == "x" ( echo Calling %SCRIPTS_DIR%\remove_old_logs.bat %CKP% %JNL% %KEEPCKPS% %KEEPLOGS%>> %LOG% call %SCRIPTS_DIR%\remove_old_logs.bat %CKP% %JNL% %KEEPCKPS% %KEEPLOGS% >> %LOG% 2>&1 echo Calling %SCRIPTS_DIR%\remove_old_checkpoints.bat %CKP% %KEEPCKPS%>> %LOG% call %SCRIPTS_DIR%\remove_old_checkpoints.bat %CKP% %KEEPCKPS% >> %LOG% 2>&1 ) else ( echo Skipping removal of old checkpoints, checkpoint and server logs due to error.>>%LOG% ) cd /d "%LOGS_DIR%" if exist %LOGFILE%.%CKP% ( if exist %LOGFILE%.%CKP%.old (del /f /q %LOGFILE%.%CKP%.old >> %LOG% 2>&1) move /y %LOGFILE%.%CKP% %LOGFILE%.%CKP%.old >> %LOG% 2>&1 ) echo Copying %LOG% to %LOGFILE%.%CKP% >> %LOG% copy /y %LOG% %LOGFILE%.%CKP% > NUL TIME /t >> %LOG% echo Operation complete. Sending email. >> %LOG% %SCRIPTS_DIR%\blat.exe -install %mailhost% %mailfrom% %SCRIPTS_DIR%\blat.exe %LOG%.%CKP% -to %maillist% -subject "%ERRORTEXT% %COMPUTERNAME% %SDP_INSTANCE_P4SERVICE_NAME% %SCRIPT_TASK% log" if "%ERRORTEXT%x" == "x" ( echo . echo %SCRIPT_TASK% completed successfully! See %LOG% ) :END CD /D "%ORIG_DIR%"
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 27331 | C. Thomas Tyler |
Released SDP 2020.1.27325 (2021/01/29). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#1 | 18961 | C. Thomas Tyler | Released: SDP/MultiArch/2016.1/18958 (2016/04/08). | ||
//guest/perforce_software/sdp/dev/Server/Windows/p4/common/bin/clean_replica.bat | |||||
#1 | 18958 | Russell C. Jackson (Rusty) |
Replica clean up script for Windows. Just removes old journals and logs. Used when you can't or don't want to run the sync_replica scipts. |