use logrotate?
though logrotate runs as cron daily so it would not rotate logs hourly
 unless you change it's cron job as well ?

Hmmm awkward. Is this why you want to do it using a script?

oh,  from "man logrotate"  :

       Normally, logrotate is run as a daily cron job.  It will not  modify  a
       log  multiple  times  in  one  day unless the criterium for that log is
       based on the logïs size and logrotate is being run multiple times  each
       day, or unless the -f or -force option is used.


here is a logrotate file I use. redhat 9.1.

/var/log/kannel/*.log {
    sharedscripts
    postrotate
        /bin/kill -HUP `/sbin/pidof bearerbox 2> /dev/null` 2> /dev/null || true
        /bin/kill -HUP `/sbin/pidof smsbox 2> /dev/null` 2> /dev/null || true
    endscript
}

it lives in /etc/logrotate.d/ as kannel

it also more or less confirms what you suggest would work I think :)

So if you could using logrotate and an hourly cron job to run it might
be another way to do it? 

James.


On Mon, Oct 18, 2004 at 03:17:32PM +0800, Fritz Mesedilla wrote:
> 
> Our kannel logs are getting bigger everyday... I hope to rotate them on an
> hourly basis.
> 
> Can I just create a simple shell script to tar.gz each log then send a
> "killall -HUP bearerbox smsbox wapbox || true > /dev/null 2> /dev/null"?
> 
> Sample: "smsbox_20041018_1500.tar.gz"
> 
> I plan to use cron for the hourly log rotation.
> Is this safe that no log transactions will be lost?
> 
> Thanks in advance.
> 
> Fritz Mesedilla

Reply via email to