Created
February 6, 2013 16:50
-
-
Save horsley/4723938 to your computer and use it in GitHub Desktop.
multi configs's awstats update script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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