| 1 |
--- trunk/engine/setup/ispcp-setup.orig 2007-11-29 09:26:09.000000000 -0500 |
|---|
| 2 |
+++ trunk/engine/setup/ispcp-setup 2007-11-30 11:27:15.000000000 -0500 |
|---|
| 3 |
@@ -2466,18 +2466,29 @@ |
|---|
| 4 |
} |
|---|
| 5 |
|
|---|
| 6 |
# |
|---|
| 7 |
- # update apache logrotate |
|---|
| 8 |
+ # update apache logrotate (check for apache, apache2) |
|---|
| 9 |
# |
|---|
| 10 |
|
|---|
| 11 |
- if ($main::cfg{'AWSTATS_ACTIVE'} eq 'yes') { |
|---|
| 12 |
- if (-f "/etc/logrotate.d/apache") { |
|---|
| 13 |
- # TODO: Fix, if awstats.pl allready added |
|---|
| 14 |
- 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"); |
|---|
| 15 |
- } |
|---|
| 16 |
- elsif (-f "/etc/loglogrotate.d/apache2") { |
|---|
| 17 |
- # TODO: Fix, if awstats.pl allready added |
|---|
| 18 |
- 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"); |
|---|
| 19 |
+ my @apache_file = ("apache", "apache2"); |
|---|
| 20 |
+ my $apache_file; |
|---|
| 21 |
+ foreach $apache_file (@apache_file) { |
|---|
| 22 |
+ if (-f "/etc/logrotate.d/".$apache_file) { |
|---|
| 23 |
+ my $file = "/etc/logrotate.d/".$apache_file; |
|---|
| 24 |
+ # search for awstats_updateall.pl |
|---|
| 25 |
+ my $word = "awstats_updateall.pl"; |
|---|
| 26 |
+ |
|---|
| 27 |
+ open(F, '<' ,$file); |
|---|
| 28 |
+ my @lines = <F>; |
|---|
| 29 |
+ close(F); |
|---|
| 30 |
+ |
|---|
| 31 |
+ my $nummatches = grep(/$word/, @lines); |
|---|
| 32 |
+ |
|---|
| 33 |
+ # add code if not exists |
|---|
| 34 |
+ if ($nummatches == 0) { |
|---|
| 35 |
+ 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"); |
|---|
| 36 |
+ } |
|---|
| 37 |
} |
|---|
| 38 |
+ } |
|---|
| 39 |
|
|---|
| 40 |
# |
|---|
| 41 |
# manage some permission; |
|---|