ajbritton Posted July 20, 2010 Posted July 20, 2010 I'm writing a script to backup some files on a daily basis. The script handles getting rid of old backups automatically, but for ease of monitoring, results go into a single summary log. This log will obviosuly continue to grow over time and I want to be able to shrink the log when it reaches a certain size (let's say 1Mb). I could code this myself, but there must be something out there.....
Chad Posted July 20, 2010 Posted July 20, 2010 Andy, What I do in my kix scripts when I open the logfile is: $ = RedirectOutput($logfile, GetFileSize($logfile) > 51200) The second paramater determines whether the file is appended to or overwritten. In the case above, it is appended to until it reaches 50k. If it's 50k+, the content gets overwritten. It may not be exactly what you want as you lose the previous content, but if you're logging this elsewhere and this is only a summary it may be an option to consider.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now