recycle logs

To recycle JVM Logs [a.k.a SystemOut.log and SystemErr.log] -
We have separate log slice for SystemOut and SystemErr. Whenever I bounce the server, I try to clear the logs, take a backup of the logs in a folder with time and date stamp for reference. I may hold such historical backup of the logs for say two months.
Here is a batch script to create a folder with todays date and time stamp, move the files into that folder.

@echo off
@REM This script is to recycle the jvm logs

@REM To recycle
@REM 1. set the log home
set jvm_log_home="<YOUR_LOG_HOME>"
set log_bak_home="<YOUR_LOG_BACKUP_HOME"
@REM 2. Set Date variable
set today=%date:~4,2%-%date:~7,2%%date:~10,4%%time:~0,2%%time:~3,2%%time:~6,2%%
@REM 3. create a folder with date stamp
mkdir %log_bak_home%\%today%
@REM 3. move the logs to that folder
move %jvm_log_home%\*.* %log_bak_home%\%today%

Whenever I bounce the server, I try to cleanup the cache too. Here is the script to clean up the cache.
Here is the batch script to clean the cache -

@echo off
@REM This script is to recycle the temp/cache on the local server
@REM To cleanup the cache
@REM 1. goto profile home temp
set profile_temp_home="<YOUR_PROFILEHOME_TEMP_NODE"
echo "profile path=%profile_temp_home%"
@REM 2. goto servername
set server_name="<YOUR_SERVER_NAME"
@REM 3. delete all under servername
echo "here i am %profile_temp_home%"
FOR /D %%i IN (%profile_temp_home%\%server_name%\*) DO (
@REM echo %%i
rmdir /S /Q "%%i"

No comments: