~ubuntu-branches/ubuntu/hardy/awstats/hardy

« back to all changes in this revision

Viewing changes to tools/awstats_updateall.pl

  • Committer: Bazaar Package Importer
  • Author(s): Charles Fry
  • Date: 2007-02-10 11:11:02 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070210111102-bbx43ay1krtxh1nq
Tags: 6.6+dfsg-1
New upstream release (Closes: #350987, #335865)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
# Launch update process for all config files found in a particular directory.
4
4
# See COPYING.TXT file about AWStats GNU General Public License.
5
5
#------------------------------------------------------------------------------
6
 
# $Revision: 1.11 $ - $Author: eldy $ - $Date: 2005/04/22 17:34:05 $
 
6
# $Revision: 1.15 $ - $Author: eldy $ - $Date: 2006/07/23 22:57:48 $
7
7
 
8
8
 
9
9
#------------------------------------------------------------------------------
10
10
# Defines
11
11
#------------------------------------------------------------------------------
12
 
my $REVISION='$Revision: 1.11 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1;
 
12
my $REVISION='$Revision: 1.15 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1;
13
13
my $VERSION="1.0 (build $REVISION)";
14
14
 
15
15
# Default value of DIRCONFIG
21
21
 
22
22
my $AwstatsDir='';
23
23
my $AwstatsProg='';
 
24
my $LastLine='';
24
25
 
25
26
 
26
27
 
69
70
        if ($ARGV[$_] =~ /^-*h/i)                        { $helpfound=1; last; }
70
71
        if ($ARGV[$_] =~ /^-*awstatsprog=(.*)/i) { $Awstats="$1"; next; }
71
72
        if ($ARGV[$_] =~ /^-*configdir=(.*)/i)   { $DIRCONFIG="$1"; next; }
72
 
        if ($ARGV[$_] =~ /^-*excludeconf=(.*)/i) { $confexcluded{"$1"}=1; next; }
 
73
        if ($ARGV[$_] =~ /^-*excludeconf=(.*)/i) {
 
74
                        #try to get the different files to exclude
 
75
                        @conftoexclude = split(/,/, $1);
 
76
                        foreach (@conftoexclude) {
 
77
                                $confexcluded{"$_"}=1;
 
78
                        }
 
79
                        next;
 
80
        }
73
81
        if ($ARGV[$_] =~ /^-*debug=(\d+)/i)      { $Debug=$1; next; }
 
82
        if ($ARGV[$_] =~ /^-*lastline=(\d+)/i)   { $LastLine=$1; next; }
74
83
        if ($ARGV[$_] =~ /^now/i)                        { $nowfound=1; next; }
75
84
}
76
85
 
88
97
        print "Where options are:\n";
89
98
        print "  -awstatsprog=pathtoawstatspl\n";
90
99
        print "  -configdir=directorytoscan\n";
91
 
        print "  -excludeconf=conftoexclude (Note: awstats.model.conf is always excluded)\n";
 
100
        print "  -excludeconf=conftoexclude[,conftoexclude2,...] (Note: awstats.model.conf is always excluded)\n";
92
101
        print "\n";
93
102
        exit 0;
94
103
}
95
104
 
96
105
debug("Scan directory $DIRCONFIG");
97
106
 
98
 
# Scan directory $DIRCONFIG 
 
107
# Scan directory $DIRCONFIG
99
108
opendir(DIR, $DIRCONFIG) || error("Can't scan directory $DIRCONFIG");
100
109
my @filesindir = grep { /^awstats\.(.*)conf$/ } sort readdir(DIR);
101
110
closedir(DIR);
141
150
                        # Define command line
142
151
                        my $command="\"$AwstatsDir/$AwstatsProg\" -update -config=$domain";
143
152
                        $command.=" -configdir=\"$DIRCONFIG\"";
 
153
                        if ($LastLine) 
 
154
                        {
 
155
                                $command.=" -lastline=$LastLine";
 
156
                        }
144
157
                        # Run command line
145
158
                        print "Running '$command' to update config $domain\n";
146
159
                        my $output = `$command 2>&1`;
148
161
                }
149
162
        }
150
163
} else {
151
 
        print "No AWStats config file found in $DIRCONFIG\n";   
 
164
        print "No AWStats config file found in $DIRCONFIG\n";
152
165
}
153
166
 
154
167
0;      # Do not remove this line
 
168