#!/bin/sh
# Rawstats - execute this file, every time you want to update the log files
# Version 1.1 11/6/97
# Email dog.food@poboxes.com

# Lock file to prevent others from accessing, timeout at 15mins
# lockfile -l 900 | /var/lib/qw/rawstats.update.lock

# Join all the log files into one
cat /usr/local/games/quake/qw/f*.log /usr/local/games/quake/orange/f*.log > /var/lib/qw/frag.dat

# Begin calculations
/usr/local/bin/fragstat.pl

# Update to live file
rm /var/lib/httpd/htdocs/fragstat.html
mv /var/lib/httpd/htdocs/fragstat2.html /var/lib/httpd/htdocs/fragstat.html

# Create stats database and track existing players
/usr/local/bin/fragmore.pl
/usr/local/bin/frag-trk.pl

# Update live database files
rm /var/lib/qw/deaths.db /var/lib/qw/frags.db
mv /var/lib/qw/deaths2.db /var/lib/qw/deaths.db
mv /var/lib/qw/frags2.db /var/lib/qw/frags.db

/usr/local/bin/fragrank.pl			# Create ranking pages
cp /var/lib/qw/qw_*.html /var/lib/httpd/htdocs/	# Update live ranking pages
/usr/local/bin/fplayid.pl			# Create page of all players

# rm -f /var/lib/qw/rawstats.update.lock 		# Remove file lock
