awips2/deltaScripts/14.4.1/DR2715/move_offline_stats.sh
Roger Ferrel 9cf153caff Omaha #2715 Script to move stats data to new location.
Former-commit-id: 29db287a6c [formerly 74f1e03a7d4458447fad552051af969d2ea71b5e]
Former-commit-id: b2b00bb763
2014-06-11 08:58:12 -05:00

40 lines
935 B
Bash
Executable file

#!/bin/bash
# Move offline stat files from localize location to /awips2/edex/data/stats
. /awips2/edex/bin/setup.env
oldStatDir=/awips2/edex/data/utility/common_static/configured/${AW_SITE_IDENTIFIER}/stats
newStatParent=/awips2/edex/data
if [ ! -d ${oldStatDir} ] ; then
echo "ERROR: ${oldStatDir} dirctory does not exist"
echo "FATAL: The update has failed."
exit 1
fi
if [ ! -d ${newStatParent} ] ; then
rm -rf ${newStatParent}
mkdir -p ${newStatParent}
if [ $? -ne 0 ] ; then
echo "ERROR: Unable to create ${newStatParent}"
echo "FATAL: The update has failed"
exit 1
fi
fi
cp -R -p ${oldStatDir} ${newStatParent}
if [ $? -ne 0 ] ; then
echo "ERROR: copying ${oldStatDir} to ${newStatParent} failed."
echo "FATAL: The update has failed."
exit 1
fi
rm -rf ${oldStatDir}
if [ $? -ne 0 ] ; then
echo "WARNING: Deleting ${oldStatDir} failed"
fi
echo "INFO: ${newStatParent}/stats updated from ${oldStatDir}"