#!/bin/csh -f

#
# Simple script to produce a set of dummy log files for testing rollover.sh
# You'll have to modify rollover.sh to use this.
#
# Remember rollover.sh restarts the web server!!
#
# Ade Miller 30 Jan 1996
#

#set real_log_root = "/e/p/C067"        # Real log directory root.
set real_log_root = "/e/s/log"        # Real log directory root.
set real_log_dir = $real_log_root/logs # Real log directory.
#set last_log_file = /e/p/C067/log_archive/960228.access_log.gz
set last_log_file = /e/s/log/log_archive/960228.access_log.gz
set dummy_log_dir = "/tmp/log_test"    # Dummy log directory.
set lines = 10000                      # Number of lines to copy.

# Clean up test directories.
#
if ( -d /tmp/log_test/logs) \rm -rf /tmp/log_test/logs
if ( -d /tmp/log_test/log_archive) \rm -rf /tmp/log_test/log_archive
if ( -d /tmp/log_test/log_html) \rm -rf /tmp/log_test/html

# Create directories.
#
if (! -d /tmp/log_test) mkdir /tmp/log_test
if (! -d /tmp/log_test/logs) mkdir /tmp/log_test/logs
if (! -d /tmp/log_test/log_archive) mkdir /tmp/log_test/log_archive
if (! -d /tmp/log_test/html) mkdir /tmp/log_test/html

# Copy first N lines to dummy directories.
#
gunzip -c $last_log_file | head -$lines > $dummy_log_dir/logs/access_log

foreach file ( `ls $real_log_dir` )
  head -$lines $real_log_dir/$file >>! $dummy_log_dir/logs/$file
end
echo "LOGS DIR:"
ls $dummy_log_dir/logs
echo "LOGS ARCHIVE:"
ls $dummy_log_dir/log_archive
echo " "


