Full_Name: Marco A. Zamora C.
Version: 2.3.5
OS: HP-UX 10.20 w/current patches
Submission from: goofy.cbbanorte.com.mx (207.249.130.209)


I rotate logs by the usual Unix convention of renaming the logfile
and signalling the daemon process, which normally makes the daemon
close the existing file and create a new one without restarting.

In the specific case of Apache, I've scripted the following, running 
from cron:
        cd /var/log/httpd
        somefile=0
        DATE=`date +%y%m%d%H%M%S`
        for file in *_log; do
          mv $file $file.$DATE
          somefile=1
        done
        if [ $somefile -eq 0 ]; do
          echo "`basename $0`: Wierdness: no *_log files in `pwd`, aborting rotation"
1>&2
          exit 1
        done
        /opt/apache/bin/apachectl graceful
        # Wait until the logfiles are freed or 5 mins pass:
        secs=0
        while fuser *_log.$DATE 2>/dev/null | grep -q '[0-9]'; do
          secs=`expr $secs + 5`
          if [ $secs -ge 300 ]; then
            echo "`basename $0`: ERROR: Apache does not free $file, aborting rotation"
1>&2
            exit 1
          fi
          sleep 5
        done
        for file in *_log.$DATE; do
          gzip -9 $FILE
        done
        [..more code that processes website statistics and so forth...]

The problem is that the "httpd -DSSL" children do not close the
existing error_log file on the graceful restart. Nor do they with a
plain restart.

I've had to kludge around this problem by doing a "stop; sleep; start",
which is really not a nice way to do it.

My main server config says:
        ErrorLog /var/log/httpd/error_log
The SSL virtual host (<VirtualHost _default_:443>) also has the
same line, as per the docs somewhere.

Thanks in advance, great work :-)...    Marco Zamora


______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      [EMAIL PROTECTED]
Automated List Manager                            [EMAIL PROTECTED]

Reply via email to