#!/bin/bash
source ~/.gamerc

fulldate=$1
date=$(echo ${fulldate} | cut -c5-)
outputdate=$(date +%Y%m%d)

for set in 1 2 3 4 5 6 7 8 11 14 19 20 21; do
	echo GAMEDB${set} | colorize yellow black
	ssh GAMEDB${set} "xcat ~/servers*/Log/${fulldate}/MissionServer${set}/FamilyWar*.log.${date}* | egrep ',\[SeasonReward\]' > /tmp/m12global_s${set}_familywar_seasonreward.log"
	ssh TEST "if [ ! -d ~/www/download/m12global_familywar_seasonreward_${outputdate}/ ]; then mkdir -p ~/www/download/m12global_familywar_seasonreward_${outputdate}/; fi"
	ssh GAMEDB${set} "rsync -avz /tmp/m12global_s${set}_familywar_seasonreward.log TEST:~/www/download/m12global_familywar_seasonreward_${outputdate}/" 
done
