Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically rename the log file of SD 4.5

Highlighted
Praveena
Regular Collector

Automatically rename the log file of SD 4.5

Hello,

Please help us write a batch file that automatically renames the SD server log once it reaches 10 MB....

How do i check the file size?

If i am not wrong the code to rename the file is:


@ echo off
NET STOP "hp OpenView service desk 4.5 server"
for /F "tokens=1-4 delims=/ " %%A in ('echo %date%') do rename logserver.txt logserver%%B%%C%%D.txt
NET START "hp OpenView service desk 4.5 server"


Thanks in advance..

OS: Windows server 2003
SD version: 4.5 Service Pack 21


-Praveena
4 REPLIES
Mark O'Loughlin
Honored Contributor

Re: Automatically rename the log file of SD 4.5

Praveena
Regular Collector

Re: Automatically rename the log file of SD 4.5

Thanks Mark,

I am able to rename the log file with those commands.

What I am looking at is how to check the file size before renaming...

So that i can schedule it to rename automatically once the log reaches 10 MB

-Praveena
Mark O'Loughlin
Honored Contributor

Re: Automatically rename the log file of SD 4.5

Hi,

another way of looking at it is to save the script as a batch file and use the op sys scheduler to run it either, every day or week to ensure that it is kept to a reasonable size. I think that is easier that trying to trigger it to run on file size and and least you will be expecting it to run on a certain day and certain time so you can check from time to time that it is running.
Praveena
Regular Collector

Re: Automatically rename the log file of SD 4.5

Thanks Guys,

Now we have a job running to reamen the logfile
//Add this to "OnDomLoad" event