summaryrefslogtreecommitdiff
path: root/localwebstats
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2002-01-17 17:09:42 +0000
committerJonas Smedegaard <dr@jones.dk>2002-01-17 17:09:42 +0000
commit3ef4189d9badf84700e7450525c094be1ff18c43 (patch)
tree96dd8a1426242863052bedbbb272be3a91fa2eda /localwebstats
parentd4ef4d39f3ee20b402e9958824d06e67cd2af6f5 (diff)
localwebstats: use find instead of ls (no complaints with empty result).
Diffstat (limited to 'localwebstats')
-rwxr-xr-xlocalwebstats6
1 files changed, 3 insertions, 3 deletions
diff --git a/localwebstats b/localwebstats
index fae1e35..819e777 100755
--- a/localwebstats
+++ b/localwebstats
@@ -53,12 +53,12 @@ fi
WEBROOT=/var/www
LOGROOT=/var/log/apache
-# $1=LOGROOT, $2=WEBROOT and $3 is WEBSITE
+# Options: $1=LOGROOT, $2=WEBROOT, $3=WEBSITE
function statsdir() { echo $2/VIRTUAL/stats.$(dnsdomainname)/www/$3; }
function webdirs() { find $1 -type d -mindepth 1 -maxdepth 1 | grep '\.*\.' | sed 's!$1!!'; }
#function logfiles() { $(ls -r $LOGDIR/*-access*.gz) $(ls -r $LOGDIR/access*.??.gz) $(ls -r $LOGDIR/access*.?.gz) $(ls -r $LOGDIR/access*.?); }
-function logcontentresolved() { for file in $(ls $1/$3/????.??.00.gz); do zcat $file; done; for file in $(ls $1/$3/????.??.00); do cat $file; done; }
-function logcontent() { for file in $(ls $1/$3/????.??.??.gz | grep -v '\.00\.gz$'); do zcat $file; done; for file in $(ls $1/$3/????.??.?? | grep -v '\.00$'); do cat $file; done; }
+function logcontentresolved() { for file in $(find $1/$3 -name '????.??.00.gz' -type f -mindepth 1 -maxdepth 1 -follow); do zcat $file; done; for file in $(find $1/$3 -name '????.??.00' -type f -mindepth 1 -maxdepth 1 -follow); do cat $file; done; }
+function logcontent() { for file in $(find $1/$3 -name '????.??.??.gz' ! -name '*00.gz' -type f -mindepth 1 -maxdepth 1 -follow); do zcat $file; done; for file in $(find $1/$3 -name '????.??.??' ! -name '*00' -type f -mindepth 1 -maxdepth 1 -follow); do cat $file; done; }
function host() { cat $2/VIRTUAL/$3/hostname || exit1 "Unable to get hostname for virtual host."; }
function domain() { cat $2/VIRTUAL/$3/domainname || exit1 "Unable to get domainname for virtual host."; }
function analog_cfg() { echo /etc/analog_$3.conf; }