From a84d0175e6d69d67e6e4f00c814cdb0c70a5df6e Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Thu, 5 Apr 2018 14:48:18 -0400 Subject: [PATCH] some things --- stats/analyze_hdb_logs | 4 +++- stats/index.php | 11 ++++++++--- themes/heyderebub/index.htm | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/stats/analyze_hdb_logs b/stats/analyze_hdb_logs index f46876d..72c1235 100755 --- a/stats/analyze_hdb_logs +++ b/stats/analyze_hdb_logs @@ -1,4 +1,6 @@ #!/bin/bash -/bin/zcat /var/log/apache2/heyderebub.com_access.log.*.gz | /usr/local/bin/goaccess --log-format=COMBINED -f /var/log/apache2/heyderebub.com_access.log -f /var/log/apache2/heyderebub.com_access.log.1 -o /var/www/heyderebub.com/public_html/stats/stats.html +LOG_DIR=/var/log/apache2/heyderebub.com_access + +zcat $LOG_DIR.log.*.gz | goaccess --no-global-config --log-format=COMBINED -f $LOG_DIR.log -f $LOG_DIR.log.1 -o stats.html diff --git a/stats/index.php b/stats/index.php index 9093bf5..af97188 100644 --- a/stats/index.php +++ b/stats/index.php @@ -1,6 +1,11 @@ 1 * 3600) - exec("./analyze_hdb_logs"); -echo file_get_contents("stats.html"); +if (!file_exists("stats.html") || time() - filemtime("stats.html") > 3600) { + echo shell_exec("./analyze_hdb_logs 2>&1"); +} + +if (file_exists("stats.html")) + echo file_get_contents("stats.html"); +else + echo "script didn't run. fix it."; diff --git a/themes/heyderebub/index.htm b/themes/heyderebub/index.htm index 7c03216..c1b1a03 100644 --- a/themes/heyderebub/index.htm +++ b/themes/heyderebub/index.htm @@ -13,6 +13,7 @@ +