Former-commit-id:f95e0ad10b
[formerly2f517b7713
] [formerly00332e6305
[formerly c03222bb480d87c05982b4d49f863e615b5b5584]] Former-commit-id:00332e6305
Former-commit-id:4accbb80db
69 lines
2.1 KiB
Bash
69 lines
2.1 KiB
Bash
#!/bin/bash
|
|
if [ ${#AWIPS_HOME} = 0 ]
|
|
then
|
|
path_to_script=`readlink -f $0`
|
|
export AWIPS_HOME=$(dirname $(dirname $(dirname $(dirname $path_to_script))))
|
|
fi
|
|
|
|
# $1 = Primary site
|
|
# $2 = Failed site
|
|
# $3 = enable/disable troubleshooting mode
|
|
|
|
if [ $# -ne 3 ]
|
|
then
|
|
log_msg "Incorrect number of arguments\nCorrect usage: request_configuration primary_site failed_site trMode"
|
|
exit 1
|
|
fi
|
|
|
|
. ${AWIPS_HOME}/GFESuite/ServiceBackup/configuration/svcbu.env
|
|
|
|
# Create the log file
|
|
logdir=${IFPS_LOG}/`date +%Y%m%d`
|
|
logfil=svcbu_request_configuration_`date +%H%M`
|
|
logfile=${logdir}/${logfil}
|
|
[ ! -d ${logdir} ] && (umask 000;mkdir ${logdir})
|
|
touch ${logdir}/${logfil}
|
|
exec 1>${logdir}/${logfil} 2>&1
|
|
|
|
# Check the status of the lock file to see if we are OK to proceed
|
|
if [ -f ${LOCK_DIR}/importConfiguration ];
|
|
then
|
|
log_msg Cannot import configuration for $2. Import configuration process already in progress!
|
|
exit 1
|
|
fi
|
|
|
|
touch ${LOCK_DIR}/importConfiguration
|
|
if [ $3 -eq 1 ]; then
|
|
touch ${LOCK_DIR}/trMode
|
|
log_msg "You are in troubleshooting mode - no ISC/VTEC will be available"
|
|
fi
|
|
|
|
log_msg Contacting central server to get configuration for ${2}
|
|
log_msg 0
|
|
|
|
if [ -n "${SVCBU_WMO_HEADER}" ]; then
|
|
msgSendOutput=$($MSG_SEND_COMMAND -a "DEFAULTNCF" -i ${SVCBU_WMO_HEADER} -s ${2}2 -c 21 -p 1)
|
|
exitValue=$?
|
|
if [ $exitValue -ne 0 ]; then
|
|
log_msg "msg_send failed while requesting configuration for ${CAPS_SITE}`date`"
|
|
rm -f ${LOCK_DIR}/importConfiguration
|
|
rm -f ${LOCK_DIR}/trMode
|
|
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
|
|
exit 1
|
|
fi
|
|
else
|
|
msgSendOutput=$($MSG_SEND_COMMAND -a "DEFAULTNCF" -s ${SITE}2 -c 21 -p 1)
|
|
exitValue=$?
|
|
if [ $exitValue -ne 0 ]; then
|
|
log_msg "msg_send failed while requesting configuration for ${2}`date`"
|
|
rm -f ${LOCK_DIR}/importConfiguration
|
|
rm -f ${LOCK_DIR}/trMode
|
|
log_msg "msg_send FAILED with exit value $exitValue and the following error: $msgSendOutput"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
log_msg Successfully sent message. MESSAGE ID: $msgSendOutput
|
|
log_msg 30
|
|
log_msg "Waiting to receive configuration..."
|
|
exit 0
|