#!/bin/sh
# A job to be run from crontab to create a gif of the countries
# Uses pgmmap.awk and the netpbm utilities.  Feel free to substitute
# other utilities if you don't have ppmtogif on your machine.
# (gifs are much smaller than pgm files in this case)
# set EMPIREDIR (and CLIENT, EMPIREHOST, EMPIREPORT if necesssary) to
# the appropriate values and edit the deity name and password.
# Create an mpeg directory in next to data/ and bin/.
# Run from crontab during times when you are not likely to be logged on
# (or create a deity account just for this process).
#	-harmless

_verbose=false
_logit=false

CLIENT=/home/dld/bin/empire
EMPIREDIR=/emp/river
EMPIREHOST=localhost
EMPIREPORT=1617

export EMPIREHOST EMPIREPORT

cd $EMPIREDIR
cd mpeg

rm -f version report map-`cat frames`.pgm

$CLIENT Azathoth az_password <<EOF
	version > version
	report * >report
	dump * | ./pgmmap.awk | /usr/local/netpbm/ppmtogif >map-`cat frames`.gif
	bye
EOF

awk '{ print $1 + 1; }' frames > frames.new
rm frames
mv frames.new frames

