Marcus Mendes wrote: > > Hello, > > How can I rotate my Z2.log?? It's very large ! > Using the same method as for rotating Apache logs. For instance, on my Debian Linux I created the file /etc/cron.daily/zope_daily (made via copying and editing equivalent file for Apache), which rotates logs. Examine the attachement... -- Serwis dla programistów, kącik mieszkaniowy: http://www.mk.w.pl | | The only way to truly control a software project is to continuously | measure its progress, compare that to the plan, and then adjust the | development parameters to correct any deviation. Simple. (Martin)
#!/bin/sh # # Rotowanie logów zope cd /opt/Zope-var/var LOGS=/opt/Zope-var/var/Z2.log USR=www-data GRP=www-data [ -f $LOGS ] || exit 0 APACHE_OLD_LOGS=35 APACHE_DAYS_TO_RUN=all APACHE_DAY_TO_RUN=any APACHE_POST_SCRIPT= APACHE_CHOWN_LOGFILES=1 umask 022 RUNTODAY=0 if [ "$APACHE_DAY_TO_RUN" = "any" ] ; then # Get today's day and convert to lowercase. TODAY=$(date +%a | tr 'A-Z' 'a-z') # Convert days_to_run to lowercase. APACHE_DAYS_TO_RUN=$(echo $APACHE_DAYS_TO_RUN | tr 'A-Z' 'a-z') echo "$APACHE_DAYS_TO_RUN" | grep -q "$TODAY" && RUNTODAY=1 [ "$APACHE_DAYS_TO_RUN" = "all" ] && RUNTODAY=1 else # Get today's day: 01 .. 31 TODAY=$(date +%d | cat) if [ $APACHE_DAY_TO_RUN = "$TODAY" ] ; then RUNTODAY=1; fi # Get today's day: 001 .. 366 TODAY=$(date +%j | cat) if [ $APACHE_DAY_TO_RUN = "$TODAY" ] ; then RUNTODAY=1; fi fi if [ "$RUNTODAY" = "1" ] ; then for LOG in $LOGS do if [ -f $LOG ] then if [ "$APACHE_CHOWN_LOGFILES" = "1" ] then savelog -c $APACHE_OLD_LOGS -m 664 -u $USR -g $GRP \ $LOG > /dev/null else savelog -c $APACHE_OLD_LOGS -m 644 -u root -g root \ $LOG > /dev/null fi fi done /etc/init.d/zope restart # # Send a reload signal to the e server. # /etc/init.d/apache reload > /dev/null # Run apache post processing script if executable. if [ -x "$APACHE_POST_SCRIPT" ] then $APACHE_POST_SCRIPT fi fi