Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Perl script log sync issue



on 10/29/04 3:19 AM, webmaster at email@hidden wrote:

> I've got a perl script running (amavisd) which I'm trying to rotate the
> log file, problem is, it quits perl and leaves the process not running.
> 
> Anyone have a solution?
> 

Here's an excerpt of code I use for apache log rolling (using the
Logfile::Rotate module). It should be adaptable to your app.


use Carp;
use DBI;
use Logfile::Rotate;



        $acclog = new Logfile::Rotate(     File => $dom->{'accesslog'},
                                            Count => 7,
                                            Gzip =>    'lib',
                                            Post =>    sub{
                                                open(IN,
"/usr/local/apache/logs/httpd.pid");
                                                chomp($pid = <IN>);
                                                kill("SIGUSR1", $pid); }
                                        );
        $errlog = new Logfile::Rotate(     File => $dom->{'errorlog'},
                                            Count => 7,
                                            Gzip =>    'lib',
                                            Post =>    sub{
                                                open(IN,
"/usr/local/apache/logs/httpd.pid");
                                                chomp($pid = <IN>);
                                                kill ("SIGUSR1", $pid); }
                                        );

    if(!$acclog->rotate()) {
        $msg{'errors'} .= "Could not rotate access log for domain
$dom->{'domain'}\n\n";
    }              
    if(!$errlog->rotate()) {
        $msg{'errors'} .= "Could not rotate error log for domain
$dom->{'domain'}\n\n";
    }              
                   
    undef $acclog;
    undef $errlog; 



-- 
Randall Perry
sysTame

Xserve Web Hosting/Co-location
Website Design/Development
WebObjects Hosting
Mac Consulting/Sales

http://www.systame.com/


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macos-x-server mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/macos-x-server/email@hidden

This email sent to email@hidden

References: 
 >Perl script log sync issue (From: webmaster <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.