Changeset 932

Show
Ignore:
Timestamp:
11/29/07 23:09:05 (12 months ago)
Author:
rats
Message:

* Fixed #835: Add awstats_updateall.pl to logrotate config

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/engine/setup/ispcp-setup

    r931 r932  
    24672467 
    24682468        # 
    2469         # update apache logrotate 
    2470         # 
    2471  
    2472         if ($main::cfg{'AWSTATS_ACTIVE'} eq 'yes') { 
    2473                 if (-f "/etc/logrotate.d/apache") { 
    2474                         # TODO: Fix, if awstats.pl allready added 
    2475                         sys_command_rs("sed -i 's#sharedscripts#sharedscripts\n\tprerotate\n\t\t$main::cfg{'AWSTATS_ROOT_DIR'}/awstats_updateall.pl now -awstatsprog=$main::cfg{'AWSTATS_ENGINE_DIR'}/awstats.pl\n\tendscript#g' /etc/logrotate.d/apache"); 
     2469        # update apache logrotate (check for apache, apache2) 
     2470        # 
     2471 
     2472        @apache_file = ("apache", "apache2"); 
     2473        foreach $apache_file (@apache_file) { 
     2474                if (-f "/etc/logrotate.d/apache".$apache_file) { 
     2475                        $file = "/etc/logrotate.d/".$apache_file; 
     2476                        # search for awstats_updateall.pl 
     2477                        $word = "awstats_updateall.pl"; 
     2478 
     2479                        open(F, '<' ,$file); 
     2480                        @lines = <F>; 
     2481                        close(F); 
     2482 
     2483                        $nummatches = grep(/$word/, @lines); 
     2484 
     2485                        # add code if not exists 
     2486                        if ($nummatches == 0) { 
     2487                                sys_command_rs("sed -i 's#sharedscripts#sharedscripts\n\tprerotate\n\t\t$main::cfg{'AWSTATS_ROOT_DIR'}/awstats_updateall.pl now -awstatsprog=$main::cfg{'AWSTATS_ENGINE_DIR'}/awstats.pl &> /dev/null\n\tendscript#g' /etc/logrotate.d/$apache_file"); 
     2488                        } 
    24762489                } 
    2477                 elsif (-f "/etc/loglogrotate.d/apache2") { 
    2478                         # TODO: Fix, if awstats.pl allready added 
    2479                         sys_command_rs("sed -i 's#sharedscripts#sharedscripts\n\tprerotate\n\t\t$main::cfg{'AWSTATS_ROOT_DIR'}/awstats_updateall.pl now -awstatsprog=$main::cfg{'AWSTATS_ENGINE_DIR'}/awstats.pl\n\tendscript#g' /etc/logrotate.d/apache2"); 
    2480                 } 
     2490        } 
    24812491 
    24822492        #