awips2/nativeLib/files.native/awipsShare/hydroapps/set_hydro_env

114 lines
3.7 KiB
Bash

#! /bin/ksh
# set_hydro_env
#
# This script sets up the environment so that ohdlib based programs can be
# executed from the command line.
#
#AWIPS_MODIFICATION_BLOCK_BEGIN
# ****** Update This Line as Needed
export AW_SITE_IDENTIFIER=OAX
# locate EDEX_HOME
if [ "${EDEX_HOME}" = "" ]; then
default_edex_home="/awips2/edex"
if [ ! -d ${default_edex_home} ]; then
echo "Unable to locate EDEX_HOME: /awips2/edex"
exit 1
fi
export EDEX_HOME=${default_edex_home}
fi
if [ "${LOCALIZATION_ROOT}" = "" ]; then
export LOCALIZATION_ROOT=${EDEX_HOME}/data/utility/common_static
fi
# Export the apps_dir environment variable
export apps_dir=/awips2/edex/data/share/hydroapps
# update the path to include the location of the runso rary.ohd.utility
export PATH=$PATH:${EDEX_HOME}/bin:${apps_dir}/bin
# contains the path to the ohd libraries and JNI-related library/libraries
export LD_LIBRARY_PATH=${EDEX_HOME}/lib/native/linux32:${apps_dir}/lib/native/linux32:$LD_LIBRARY_PATH
export RFCLX=${apps_dir}
#AWIPS_MODIFICATION_BLOCK_END
export POSTGRESQLDIR=/usr
export POSTGRESQLBINDIR=/awips2/psql/bin
export APPS_DEFAULTS_SITE=${LOCALIZATION_ROOT}/site/${AW_SITE_IDENTIFIER}/hydro/Apps_defaults
export APPS_DEFAULTS=${LOCALIZATION_ROOT}/base/hydro/Apps_defaults
# define a get_apps_defaults function for retrieving application token values
get_apps_defaults() {
runso rary.ohd.util gad $1
}
# OS_SUFFIX is the suffix used for filenames to identify the operating system
export OS_SUFFIX=".LX"
export geo_data=$RFCLX/geo_data
export PGOPTIONS='-c standard_conforming_strings=on'
export FXA_HOME=/awips/fxa
export FXA_BIN_DIR=$FXA_HOME/bin
# The following variables provide a JDBC URL or pieces thereof for
# SSHP and any other java programs that access the IHFS database
# The final form of the url is something like
# jdbc:postgresql://dx1:5432/hd_ob6abc?user=oper
export PGHOST=$(get_apps_defaults pghost)
export PGPORT=$(get_apps_defaults pgport)
export DB_NAME=$(get_apps_defaults db_name)
export PGUSER=$(get_apps_defaults pguser)
export DAMCAT_DB_NAME=$(get_apps_defaults damcat_db_name)
DB_URL='postgresql://'$PGHOST':'$PGPORT'/'$DB_NAME'?user='$PGUSER''
DAMCREST_DB_URL='postgresql://'$PGHOST':'$PGPORT'/'$DAMCAT_DB_NAME'?user='$PGUSER''
export JDBCURL=jdbc:$DB_URL
export DAMCREST_JDBCURL=jdbc:$DAMCREST_DB_URL
if [ "${PGSQL_DRIVER_DIR}" = "" ]; then
DB_DRIVER_DIR=${EDEX_HOME}/lib/dependencies/org.postgres
else
DB_DRIVER_DIR=${PGSQL_DRIVER_DIR}/
fi
cd $DB_DRIVER_DIR
files=$(find . | grep postgresql | grep jar)
for i in $files
do
echo $i
PGSQL_DRIVER_JAR=$i
done
export DB_DRIVER_PATH=${DB_DRIVER_DIR}/${PGSQL_DRIVER_JAR}
cd -
#===========================================================================
# This is stuff extracted from the original HYDRO_ENV
# and are used in run and start scripts and other files
#===========================================================================
# The following variable is needed for lots of scripts
export WHFS_BIN_DIR=$(get_apps_defaults whfs_bin_dir)
export WHFS_LOCAL_BIN_DIR=$(get_apps_defaults whfs_local_bin_dir)
#These variables needed to establish path to input and output files to the model in the DamCrest Application
export WHFS_LOCAL_DATA_DIR=$(get_apps_defaults whfs_local_data_dir)
export DAMCREST_DATA_DIR=$(get_apps_defaults damcrest_data_dir)
# this variable is needed to find gvim resource file .vimrc
export DAMCREST_RES_DIR=$(get_apps_defaults damcrest_res_dir)
# The following variable is needed for DamCat
export WFO_HELP_DIR=$(get_apps_defaults standard_data_dir)/help
# the following are needed for River/Precip Monitor
export RPF_LINE_WIDTH=$(get_apps_defaults rpf_linewidth)
export WHFS_UTIL_LOG_DIR=$(get_apps_defaults whfs_util_log_dir)
umask 000