#!/bin/bash
#===============================================================================
#
#          FILE: change_gw_to_test
#
#         USAGE: change_gw_to_test
#
#   DESCRIPTION: Get the newest GatewayServer binary from ftp(path: ~/patch/BGW/)
#                and change the GatewayServer binary directly
#
#       OPTIONS: N/A
#
#  REQUIREMENTS:
#
#         NOTES:
#
#          BUGS:  ---
#        AUTHOR: rickz (Rick Zhang), xlrickz@gmail.com
#       COMPANY: X-LEGEND Entertainment Corp.
#       CREATED: Wed Feb 15 15:28:32 KST 2012
#      REVISION: 1.0
#
#          TODO:
#
#===============================================================================

#set -o nounset                              # Treat unset variables as an error
#set -m                                      # Enable job control


source ~/.gamerc

rm -f ~/patch/BGW/Gateway*
yes | TestCtrl patch TEST BGW
chmod 755 ~/patch/BGW/Gateway*

SKServer stop GatewayServer
cp -v ~/servers1/bin/GatewayServer ~/servers1/bin/GatewayServer.$(date +%Y%m%dT%H%M%S)
cp ~/patch/BGW/GatewayServer ~/servers1/bin/
SKServer start GatewayServer

sleep 3
killall tail
