Omaha #4103: Create delta script to migrate svcbu.properties file.

Change-Id: Id6788242786717c2ebecb96b48061a5f2e41af0a

Former-commit-id: 71a72608de003c45cf6026849b2825d64e8b56b3
This commit is contained in:
David Gillingham 2015-04-01 11:00:35 -05:00
parent cbca87a1b7
commit afc6b45fa0
2 changed files with 159 additions and 0 deletions

View file

@ -0,0 +1,104 @@
# Variables used by service backup:
#
# AWIPS_HOME: The AWIPS II installation directory.
#
# GFESUITE_HOME: The server directory containing files and programs
# used by GFE during Service Backup
#
# GFESUITE_BIN: Directory containing GFE server side utility
# programs including ifpnetCDF and iscMosaic
#
# SVCBU_HOME: Directory used by service backup as a sandbox for
# constructing files to be sent and for processing
# received files.
#
# LOCALIZATION_PATH: This is the path to the root of the localization
# directory. This path is used for properly importing
# and exporting configuration data
#
# IFPS_LOG: Directory containing logs for the service backup
# operations.
#
# IFPS_DATA: Directory containing the svcbu_export_elements file.
# This file is used to specify which weather elements are
# packaged and sent when exporting digital data for a
# site.
#
# LOCK_DIR: Directory used for lock files. Each Service Backup
# operation maintains a lock file during its execution.
# The lock remains for the duration of the operation and
# is erased upon completion to prevent simultaneous
# operations from occurring.
#
# SCRIPTS_DIR: Directory containing the scripts used by service
# backup
#
# CAVE_LAUNCH_SCRIPT: This path points to the script which starts GFE. This
# variable is read when the user hits the 'Enable' button
# On the service backup GUI.
#
# SVCBU_HOST: Server where the service backup scripts will be
# executed.
#
# MSG_SEND_COMMAND: The command executed to send a message via the message handling
# system. This value will usually be msg_send. But, it can be
# changed to a different command in a test environment.
#
# CDSPORT: This is the port on which the Thrift Client listens
# for script execution events.
#
# SVCBU_DB: Defines which database to use for exporting
# grids to central server for service backup.
# VALID VALUES: Fcst
# Official (default)
#
# SVCBU_TRIM_ELEMS: Indication of whether ifpnetCDF needs to trim
# off elements while exporting grids to central
# server.
# VALID VALUES: 1 - To do element trimming
# 0 - To disable element trimming
# Note: ${IFPS_DATA}/svcbu_export_elements.ccc
# file has to be present for this to work. This file
# will contain list of elements to include in the
# netcdf file that's being sent over to central srv.
#
# SVCBU_FAILED_SITE_PORT: Unused
#
# SVCBU_GRIDAREA: The name of the edit area used when exporting grids
# to the central server for service backup and
# imported to the Restore databse after service backup.
# DEFUALT VALUE: ISC_Send_Area
#
# SVCBU_ADDRESSEE: The name of the msg_send addressee. Will be used to
# pass with -a flag of msg_send. (NCF use only).
#
# SVCBU_WMO_HEADER: The WMO header that will be used to pass in calls to
# msg_send with -i argument. This will be empty to
# begin with. Should not be changed. (NCF use only)
#
# EXPORT_GRID Indicate the ways of grid being exported
# VALID VALUES: 0 = do not export grids
# 1 = grids are exported by quartz timer
# at 15 after each hour, the service
# backup GUI, and from GFE via the
# 'Send Grids to NDFD...' script
# 2 = grids are exported only by the service backup GUI and from GFE via the 'Send
# Grids to NDFD...' script'
#
# SVCBU_USER Indicates that the site can configure a special user to
# run GFE when in service backup
# VALID VALUES: 0 = do not use a designated user to run
# GFE when in service backup
# 1 = use a designated user to run GFE
# when in service backup
#
# SVCBU_USER_ID The user id of the designated user to run GFE when
# in service backup
#
# PRIMARY_SITES (Optional) For dual-domain sites, a comma-separated
# list of sites for the export grids cron to run for
# instead of the site defined as AW_SITE_IDENTIFIER. If
# this setting is empty or not defined, cron will only
# export grids for site set as AW_SITE_IDENTIFIER.
#
#

View file

@ -0,0 +1,55 @@
#!/bin/bash
# Determine which directory this script lives in so we can locate
# file_header.txt ...
script_path=$(dirname $(readlink -f $0))
file_header=${script_path}/file_header.txt
echo "DR #4103: Moving svcbu.properties file to localization store..."
# source edex setup.env to get primary site id
source /awips2/edex/bin/setup.env
site_id=`echo ${AW_SITE_IDENTIFIER} | tr [a-z] [A-Z]`
base_file=/awips2/edex/data/utility/edex_static/base/config/gfe/svcbu.properties
old_site_file=/awips2/GFESuite/ServiceBackup/configuration/svcbu.properties
if [[ ! -f ${base_file} ]]
then
echo "ERROR: Can not find BASE-level svcbu.properties file ${base_file}."
echo "Exiting!"
exit 1
fi
if [[ ! -f ${old_site_file} ]]
then
echo "ERROR: Can not find previous version's svcbu.properties file ${old_site_file}."
echo "Exiting!"
exit 1
fi
site_override_contents=""
config_entries=( "GFESUITE_HOME" "GFESUITE_BIN" "SVCBU_HOME" "LOCALIZATION_PATH" "IFPS_LOG" "IFPS_DATA" "LOCK_DIR" "SCRIPTS_DIR" "CAVE_LAUNCH_SCRIPT" "SVCBU_HOST" "MSG_SEND_COMMAND" "CDSPORT" "SVCBU_DB" "SVCBU_TRIM_ELEMS" "SVCBU_FAILED_SITE_PORT" "SVCBU_GRIDAREA" "SVCBU_ADDRESSEE" "SVCBU_WMO_HEADER" "SVCBU_USER" "SVCBU_USER_ID" "EXPORT_GRID" "PRIMARY_SITES" )
for entry in "${config_entries[@]}"
do
base_value=$(grep -E "^${entry}=" ${base_file})
site_value=$(grep -E "^${entry}=" ${old_site_file})
if [ "${base_value}" != "${site_value}" ]
then
site_override_contents="${site_override_contents}\n${site_value}"
fi
done
if [[ -n "${site_override_contents}" ]]
then
new_site_file=/awips2/edex/data/utility/edex_static/site/${site_id}/config/gfe/svcbu.properties
echo "Writing new site override file ${new_site_file}."
cat ${file_header} > ${new_site_file}
echo "" >> ${new_site_file}
echo -e ${site_override_contents} >> ${new_site_file}
fi
rm -f ${old_site_file}