Skip to content

Instantly share code, notes, and snippets.

@horsley
Created February 6, 2013 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save horsley/4723938 to your computer and use it in GitHub Desktop.
Save horsley/4723938 to your computer and use it in GitHub Desktop.
multi configs's awstats update script
#!/usr/bin/php
<?php
/**
* Created by JetBrains PhpStorm.
* User: horsley
* Date: 13-1-30
* Time: 上午1:00
* To change this template use File | Settings | File Templates.
*
* cron -e and add this file , remember chmod + x
*/
define('AWSTATS_CFG_DIR', '/etc/awstats');
define('AWSTATS_RPT_DIR', '/home/wwwroot/awstats');
$iterator = new DirectoryIterator(AWSTATS_CFG_DIR);
foreach($iterator as $fileinfo) {
if ($fileinfo->isFile()) {
preg_match('/^awstats\.(.*)\.conf$/', $fileinfo->getFilename(), $matches);
//echo $matches[1];
system('mkdir -p '. AWSTATS_RPT_DIR .'/'. $matches[1]);
system('/usr/local/awstats/tools/awstats_buildstaticpages.pl -update -config='.$matches[1].' -lang=cn -dir=/home/wwwroot/awstats/'.$matches[1].' -awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment