You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							42 lines
						
					
					
						
							1.1 KiB
						
					
					
				
			
		
		
	
	
							42 lines
						
					
					
						
							1.1 KiB
						
					
					
				| #!/bin/bash | |
|  | |
| # Variables | |
| BASE_DIR=/opt/awstats | |
| DATA_DIR=/opt/awstats-data/data | |
| LOGS_DIR=/opt/awstats-data/logs | |
| HTML_DIR=/opt/awstats-data/html | |
| APACHE_LOG=/var/log/apache2 | |
| CONFIG_DIR=$BASE_DIR/wwwroot/cgi-bin | |
|  | |
| # Which servers have all the access.log logfiles | |
| SERVERS='server1 server2 server3' | |
|  | |
| # Make a list of all the sites that need parsing | |
| SITES=`ls $CONFIG_DIR |egrep '^awstats.*\.conf$' |grep -v awstats.model.conf |sed -e 's/^awstats\.//' -e 's/\.conf$//'` | |
|  | |
| # Start making a simple HTML page with all the sites | |
| echo "<center>" > $HTML_DIR/index.html | |
|  | |
| for s in $SITES; do | |
|  | |
|  # Copy the access logging to the local server | |
|  for i in $SERVERS; do | |
|   scp -q $i:$APACHE_LOG/$s/access.log.1.gz $LOGS_DIR/$i.$s.gz | |
|  done | |
|  | |
|  # Combine and sort the logfile's | |
|  $BASE_DIR/tools/logresolvemerge.pl $LOGS_DIR/*.$s.gz |gzip > $LOGS_DIR/$s.gz | |
|  | |
|  # Remove the server logfiles | |
|  rm $LOGS_DIR/*.$s.gz | |
|  | |
|  # Update the statistics | |
|  $BASE_DIR/wwwroot/cgi-bin/awstats.pl -config=$s -update | |
|  | |
|  # Remove the combined logfile | |
|  rm $LOGS_DIR/$s.gz | |
|  | |
|  # Write an entry in the HTML file for this website | |
|  echo "<a href='http://$s/awstats/awstats.pl'>$s</a><br />" >> $HTML_DIR/index.html | |
|  | |
| done
 | |
| 
 |