V Thrusher
asked on
Need a shell script to zip the logfiles which are older than the current date
Monthly once we need to zip the log files, which are older than the current date
What operating system are you working on?
~bp
~bp
ASKER
its a AIX server
You can download and compile the logrotate source http://www.perzl.org/aix/index.php?n=Main.Logrotate
Or you set your own cron job and script the zip.
Or you set your own cron job and script the zip.
ASKER
But i'm looking for a my own script, so i can customize to my need, instead of using log rotate
That wasn't mentioned in your initial question, but you can also customize logrotate.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
find FILE-PATH -type f -name "*.log" -mtime +1-exec ls -lrt {} \; ### lists the files to verify before running the below command
find FILE-PATH -type f -name "*.log" -mtime +1-exec tar -cvf <dirname> {} \;
note:
FILE-PATH - location of your file resides
"*.log" can be customized as per your need.
dirname - any directory name
find FILE-PATH -type f -name "*.log" -mtime +1-exec tar -cvf <dirname> {} \;
note:
FILE-PATH - location of your file resides
"*.log" can be customized as per your need.
dirname - any directory name
For Windows, you can schedule a command line winzip
http://www.ga-experts.com/downloads/log_file_rotation.pdf
Someone also created their own logrotate script back before the cygwin ports.
http://www.datori.org/logrotatew/