awips2/deltaScripts/17.1.1/DR5794/openfire-postgresql-9.5.3-upgrade/_postgres_pre_upgrade_openfire.sh
2022-05-05 12:34:50 -05:00

27 lines
692 B
Bash

#!/bin/bash
source "$(dirname $0)/settings_openfire.sh" || exit 1
if [[ "${POSTGRES_VERSION}" != ${OLD_VER} ]]; then
echo -n "ERROR: Currently installed version of PostgreSQL is "
echo "${POSTGRES_VERSION}. Expected ${OLD_VER}. Cannot continue."
exit 1
fi
echo "INFO: Copying ${POSTGRES_DIR} to ${POSTGRES_COPY_OF_OLD}."
if [[ -e ${POSTGRES_COPY_OF_OLD} ]]; then
rm -rf ${POSTGRES_COPY_OF_OLD}
fi
cp -a ${POSTGRES_DIR} ${POSTGRES_COPY_OF_OLD}
if [[ "$?" -ne 0 ]]; then
echo -en "\nERROR: Failed to copy ${POSTGRES_DIR} to ${POSTGRES_COPY_OF_OLD}"
echo "Cannot continue."
exit 1
fi
sync
echo "INFO: Pre-upgrade preparation is complete. No errors reported."