Ticket #835: patch_awstats.3.txt

File patch_awstats.3.txt, 1.8 kB (added by dominiquearpin, 1 year ago)

v3

Line 
1 --- trunk/engine/setup/ispcp-setup.orig 2007-11-29 09:26:09.000000000 -0500
2 +++ trunk/engine/setup/ispcp-setup      2007-11-29 10:36:08.000000000 -0500
3 @@ -2471,14 +2471,33 @@
4  
5         if ($main::cfg{'AWSTATS_ACTIVE'} eq 'yes') {
6                 if (-f "/etc/logrotate.d/apache") {
7 -                       # TODO: Fix, if awstats.pl allready added
8 -                       sys_command_rs("sed -i 's#postrotate#postrotate\n\t\$main::cfg{'AWSTATS_ROOT_DIR'}/awstats_updateall.pl now -awstatsprog=$main::cfg{'AWSTATS_ENGINE_DIR'}/awstats.pl#g' /etc/logrotate.d/apache");
9 +                       $file = "/etc/logrotate.d/apache";
10 +                       $word = "awstats_updateall.pl";
11 +                       
12 +                       open F, $file;
13 +                       @lines = <F>;
14 +                       close F;
15 +                       
16 +                       $nummatches = grep(/$word/, @lines);
17 +
18 +                       if ($nummatches == 0) {
19 +                               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");
20 +                       }
21                 }
22                 elsif (-f "/etc/loglogrotate.d/apache2") {
23 -                       # TODO: Fix, if awstats.pl allready added
24 -                       sys_command_rs("sed -i 's#postrotate#postrotate\n\t\{AWSTATS_ROOT_DIR}/awstats_updateall.pl now -awstatsprog=$main::cfg{'AWSTATS_ENGINE_DIR'}/awstats.pl#g' /etc/logrotate.d/apache2");
25 -               }
26 +                       $file = "/etc/logrotate.d/apache";
27 +                        $word = "awstats_updateall.pl";
28 +
29 +                        open F, $file;
30 +                        @lines = <F>;
31 +                        close F;
32  
33 +                        $nummatches = grep(/$word/, @lines);
34 +
35 +                        if ($nummatches == 0) {
36 +                       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");
37 +                       }
38 +               }
39         #
40         # manage some permission;
41         #