#! /bin/bash
# (c) Associated Universities Inc., 2002 
# (c) European Southern Observatory, 2002
# Copyright by ESO (in the framework of the ALMA collaboration),
# All rights reserved
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
# MA 02111-1307  USA
#
# "@(#) $Id: cdbTATEpilogue,v 1.6 2007/09/12 04:40:18 cparedes Exp $"
#
#
# who       when      what
# --------  --------  ----------------------------------------------
# gchiozzi  11/02/02  created
#

ACS_INSTANCE=`cat $ACS_TMP/acs_instance`

if [ "X$TAT_VERBOSE" = X ]; then
 _REDIR_=/dev/null
else
 _REDIR_=cdb.log
 echo " ****************** cdbTATEpilogue *************** " >  $_REDIR_
fi

# Sleep a few seconds to make sure all other processes have exited cleanly
sleep 5

export ACS_TMP=../test/tmp

CDB_PORT=`sed -n 1'p' $ACS_TMP/.cdbport`
rm -f $ACS_TMP/.cdbport
cdbjDALShutdown -d corbaloc\:\:$HOST\:$CDB_PORT/CDB >&  $_REDIR_
rm -f $ACS_TMP/cdb.log
rm -f ENVIRONMENTS/lcuTat/DAL.ior
rm -f $ACS_TMP/CDB_Recovery.txt
rm -f $ACS_TMP/acs_instance
rm -rf $ACSDATA/tmp/ACS_INSTANCE.$ACS_INSTANCE &> /dev/null || (echo "==> Error - cannot remove $ACSDATA/tmp/ACS_INSTANCE.$ACS_INSTANCE") 1>&2

sleep 5
exit 0

#
# ___oOo___
