I thought maybe some users may be able to use a variation of the
following script in generating their analog reports daily/weekly/monthly
from one cronjob. This script was written using cshell for a Unix
platform.

I maintain many sites and most of my clients have different scheduling
ideas for their reports. Some clients need monthly and weekly reports
while others only need daily reports. This script saved me from having
to set up separate cron entries for every report.

As long as the variables are set to "yes", a monthly report is generated
on the first day of every month, a weekly report is generated every
Monday and a daily report is generated everyday.

-Rebecca

--
***  Rebecca S. Minarik
***  [email protected]



The following directory structure is used:
/home/analog
               /bin
                       /mysite.analog          # the following script
               /config
                       /mysite.conf            # individual config file
                       /mysite.rcpts           # site recipient's list
               /images                         # images directory
               /reports                        # reports directory
                       /mysite-daily.01Mar99   # daily report
                       /mysite-weekly.01Mar99  # weekly report
                       /mysite-monthly.01Mar99 # monthly report
               /source
                       /analog.cfg             # default config file
                       /lang/*                 # languages directory
                       /domains.tab            # domains file

=========================================================================
BEGIN SCRIPT
=========================================================================
#!/bin/csh -f
# Rebecca Minarik [email protected] 22JAN98
# Rebecca Minarik [email protected] 22FEB99 - added
daily/weekly/monthly

# do you want Daily reports?
set DAILY = "yes"

# do you want Weekly reports?
set WEEKLY = "yes"

# do you want Monthly reports?
set MONTHLY = "yes"

## name of web site to analyze
set conf_files = "mysite"

# where the logfiles are located
set logdir = "/home/${conf_files}/logs"

#################################################################
# do not change below this line unless you fully understand
# what effects your changes may have on reporting
#################################################################
# where the analog stuff is installed
set anadir = "/opt/analog"

# analog bin dir.
set bindir = "$anadir/bin"

# analog config dir and list of conf files
set confdir = "$anadir/config"

# analog reports dir.
set reportsdir = "$anadir/reports"

# the logfiles you are looking at
set logfile_string = "access"

# now get a reverse listing of all the $logfile_string files in $logdir
# This puts them in date order from oldest to newest
set file_list = `/bin/ls -rt ${logdir}/${logfile_string}*`

# set the datestr to append to filename so we keep them separate from
others
set datestr = `/usr/bin/date '+%y%m%d'`



###################################################################
# generate monthly reports on the 1st of the month
###################################################################
if $MONTHLY == "yes" then
set today = `/usr/bin/date '+%d'`
if $today == "01" then
foreach conf ($conf_files)
  # find mysite.conf individual config file
  set confname = ${conf}.conf
  # read in mysite.rcpts which lists email addresses to send reports to
  set rcpts = `/bin/egrep -v '^#' ${confdir}/${conf}.rcpts`
  set outfile = "${reportsdir}/${conf}/${conf}-monthly.${datestr}"
  /bin/cat $file_list | $bindir/analog - +g$confdir/$confname
+F-00-0101 +T-00-0131 >! $outfile
  set subj = `nawk -F\" '/HOSTNAME/ {print $2 }' $confdir/$confname`
  /usr/bin/mailx -s "Monthly Stats For $subj - $datestr" $rcpts <
$outfile
end
endif
endif

###################################################################
# generate weekly reports on Mondays
###################################################################
if $WEEKLY == "yes" then
set today = `/usr/bin/date '+%a'`
if $today == "Mon" then
foreach conf ($conf_files)
  # find mysite.conf individual config file
  set confname = ${conf}.conf
  # read in mysite.rcpts which lists email addresses to send reports to
  set rcpts = `/bin/egrep -v '^#' ${confdir}/${conf}.rcpts`
  set outfile = "${reportsdir}/${conf}/${conf}-weekly.${datestr}"
  /bin/cat $file_list | $bindir/analog - +g$confdir/$confname
+F-00-00-07 +T-00-00-01 >! $outfile
  set subj = `nawk -F\" '/HOSTNAME/ {print $2 }' $confdir/$confname`
  /usr/bin/mailx -s "Weekly Stats For $subj - $datestr" $rcpts <
$outfile
end
endif
endif

###################################################################
# generate daily report
###################################################################
if $DAILY == "yes" then
foreach conf ($conf_files)
  # find mysite.conf individual config file
  set confname = ${conf}.conf
  # read in mysite.rcpts which lists email addresses to send reports to
  set rcpts = `/bin/egrep -v '^#' ${confdir}/${conf}.rcpts`
  set outfile = "${reportsdir}/${conf}/${conf}-weekly.${datestr}"
  set outfile = "${reportsdir}/${conf}/${conf}-daily.${datestr}"
  /bin/cat $file_list | $bindir/analog - +g$confdir/$confname
+F-00-00-01 +T-00-00-01 >! $outfile
  set subj = `nawk -F\" '/HOSTNAME/ {print $2 }' $confdir/$confname`
  /usr/bin/mailx -s "Daily Stats For $subj - $datestr" $rcpts <
$outfile
end
endif

=========================================================================
END SCRIPT
=========================================================================