dfm_broker.sh #1

  • //
  • guest/
  • perforce_software/
  • sdp/
  • dev/
  • Server/
  • Unix/
  • p4/
  • common/
  • hms/
  • scripts/
  • dfm_broker.sh
  • View
  • Commits
  • Open Download .zip Download (1 KB)
#!/usr/local/bin/bash
Version=1.0.2

# Usage: dfm_broker.sh INSTANCE on|off
#
# If on:
#    Disable the and any other brokers for this instance.
#    Enable the dfm (Down For Maintenance) broker for the instance.
#
# If off:
#    Disable the dfm (Down For Maintenance) broker for the instance.
#    Enable the default broker for the instance.

# Do nothing unless $SDP_INSTANCE is defined.
export SDP_INSTANCE=${1:-Unset}
declare Mode=${2:-Unset}
declare BrokerInitScript=/p4/$SDP_INSTANCE/bin/p4broker_${SDP_INSTANCE}_init

if [[ $SDP_INSTANCE == Unset ]]; then
   echo -e "\nError: The SDP_INSTANCE is not defined.\n."
   exit 1
fi

if [[ ${Mode^^} != ON && ${Mode^^} != OFF ]]; then
   echo -e "\nError: Bad usage.  Usage:\n\t${0##*/} INSTANCE on|off\n"
   exit 1
fi

if [[ ! -x $BrokerInitScript ]]; then
   echo -e "\nError: $BrokerInitScript is not executable."
   exit 1;
fi

# Note: We stop all configured brokers, but when DFM is done, we only
# restart the default broker.  Any others need to be restarted manually.
if [[ ${Mode^^} == ON ]]; then
   $BrokerInitScript stop all
   $BrokerInitScript start dfm
else
   $BrokerInitScript stop dfm
   $BrokerInitScript start
fi
# Change User Description Committed
#2 20801 C. Thomas Tyler Implemented security: 'p4 hms' commands require a super user to be logged in.
Added 'p4 sbi' (show broker input) broker debugging utility.
#1 20745 C. Thomas Tyler Approving as is since it isn't changing core SDP functionality, and reviewing it all line by line will take some time.
We can do that as we move forward with it.

First addition of HMS v1.0 files.  This change is a soft launch HMS
for initial deployment and testing.

Updates to HMS-related files are expected and will bypass pre-commit
code review until stabilized.