Omaha #2715 Script to move stats data to new location.

Former-commit-id: 0c2d66c29a [formerly 7714c7c3ac] [formerly 29db287a6c] [formerly 0c2d66c29a [formerly 7714c7c3ac] [formerly 29db287a6c] [formerly b2b00bb763 [formerly 29db287a6c [formerly 74f1e03a7d4458447fad552051af969d2ea71b5e]]]]
Former-commit-id: b2b00bb763
Former-commit-id: 6643b75d36 [formerly c265741346] [formerly a7e275ba3520c254c13cc0158c9f7bf0ac4cd425 [formerly 9cf153caff]]
Former-commit-id: 667aa8542b1da80ed4d816ee3c388d662884ccd6 [formerly 1230497c03]
Former-commit-id: e2e0df04c2
This commit is contained in:
Roger Ferrel 2014-06-11 08:49:39 -05:00
parent 677a2cde2c
commit 936c184c56

View file

@ -0,0 +1,40 @@
#!/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}"