I have been given the task of writing a script to archive the logs (to a tar file or better method) periodically. I am fairly new to Solaris,how do I get this done ????
As far as i can understand from you question, you want to schedule some sort of activity which should occur periodically say everyday or once in a week or similar. And, that activity should be like archiving the logs when size goes beyond some predefined limit. If that's what you want to do then you can take help of logrotate and cron daemons. Cron is scheduler and logrotate does exctly what you are looking for .
As Mahesh says use cron. You may not have logrotate (I haven't). But gzip is also excellent (if you have it) with logfiles , when a file is gzipped it then has a suffix of ".gz". Your cron file can have an entry such as : -
00 04 * * * /opt/logs/zipper.ksh
This means run script at 4am every day. If we look at script, we see: -
cat /opt/logs/zipper.ksh
#!/bin/ksh
# Script to find files in a directory and gzip them.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.