Created
April 18, 2012 01:17
-
-
Save ha1t/2410311 to your computer and use it in GitHub Desktop.
visitors使ってたなー
This file contains hidden or 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
<?php | |
/** | |
* visitorsでログを作るスクリプト | |
* | |
* need nkf,visitors,apache2 | |
*/ | |
error_reporting(E_ALL); | |
ini_set('display_errors', 'On'); | |
/** | |
* visitors bin path | |
*/ | |
$visitors_path = '/usr/bin/visitors'; | |
/** | |
* apache2 log path | |
*/ | |
$date = date("Ym"); | |
$log_path = "/var/log/apache2/access_log.{$date}*"; | |
/** | |
* output path | |
*/ | |
$now_date = date("Y-m-d"); | |
$output_path = "/home/halt/public_html/admin/visitors/{$now_date}.html"; | |
if (!file_exists($visitors_path)) { | |
debug_print('visitors not found'); | |
exit(); | |
} | |
$command = $visitors_path; | |
$command.= " -A -m 100 "; | |
$command.= $log_path; | |
$command.= " | nkf -w -m0 > "; | |
$command.= $output_path; | |
debug_print($command); | |
//system($command); | |
exec($command); | |
function debug_print($message) | |
{ | |
//print($message . "\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment