#!/bin/csh

########################################################################
############ DEFINE check_data_late alias ##########
########################################################################
#
# usage: check_date_late 27/Oct    (use between 11pm and 2pm)
# usage: check_date_early 27/Oct   (use between 2pm and 11pm)
#
#  desc: how many unique hosts in httpd-xfer and httpd-xfer.andria on Oct 27?
#        (httpd-xfer & httpd-xfer.andria must be uncompressed)
#
########################################################################

set SBDIR = "/cs/htuser/andria/public_html/statbot/"
#set LOGDIR = "/cs/ftp/pub/issac/test/log/"
set LOGDIR = "/cs/htuser/andria/public_html/log/"

alias check_date_late  "zcat ${LOGDIR}httpd-xfer.andria.gz | \\
                       egrep \!* | sed -f ${SBDIR}.get_host_name | sort -u | wc -l"

alias check_date_early "zcat ${LOGDIR}large_backup/httpd-xfer.Mar_Apr_00.gz | \\
                       egrep \!* | sed -f ${SBDIR}.get_host_name | sort -u | wc -l"

alias check_date_now "cat ${LOGDIR}httpd-xfer ${LOGDIR}httpd-xfer.andria | \\
                       egrep \!* | sed -f ${SBDIR}.get_host_name | sort -u | wc -l"

########################################################################
############ For the day and month specified, determine how ############
############ many unique hosts accessed the pages.          ############
########################################################################
############ Use check_date_late between 11pm and 2pm, and  ############
############ use check_date_early between 2pm and 11pm.     ############
########################################################################

set MONTH = "Apr"
echo "Looking at days in $MONTH"

foreach DAY (01 02 03 04 05 06 07 08 09 10 \
             11 12 13 14 15 16 17 18 19 20 \
             21 22 23 24 25 26 27 28 29 30 31)
   echo "${MONTH} ${DAY}: " `check_date_early   ${DAY}/${MONTH}`
end

#foreach DAY (01 02 03 04 05 06 07 08 09 10 \
#             11 12 13 14 15 16 17 18 19 20 \
#             21 22 23 24 25 26 27 28 29 30 31)
#   echo "${MONTH} ${DAY}: " `check_date_early ${DAY}/${MONTH}`
#end

