ref: 6a179c0db1f31cbab6cff01639f9e7c73276ca92
dir: /logrotate/
#!/bin/rc # # edit these 4 variables to your preference # 0 0 * * 0 $sysname /usr/glenda/bin/logrotate # logdir=/sys/log logfiles=(auth cpu cron dns gemini listen mail runq smtp smtp.fail smtpd) generations=14 maxsize=102400 if(! test -d $logdir){ echo $logdir does not exist exit } fn Rotate{ gen=$generations while(test $gen -ge '0'){ pgen=`{echo $gen - 1|bc} if(test -f $logdir/$1.$pgen.gz){ cp $logdir/$1.$pgen.gz $logdir/$1.$gen.gz chmod 0700 $logdir/$1.$gen.gz } gen=$pgen } gzip -c $logdir/$1 > $logdir/$1.0.gz } for(i in $logfiles){ if(test -f $logdir/$i){ size=`{du -n $logdir/$i|awk '{print $1}'} if(test $size -gt $maxsize){ Rotate $i # # I is dum - logfile are open/append at boot so I caveman smash. help me. # rm -f $logdir/$i touch $logdir/$i chmod 0662 $logdir/$i } } }