#!/p4/common/bash/bin/bash #============================================================================== # Copyright and license info is available in the LICENSE file included with # the Server Deployment Package (SDP), and also available online: # https://swarm.workshop.perforce.com/projects/perforce-software-sdp/view/main/LICENSE #------------------------------------------------------------------------------ #============================================================================== # Declarations and Environment set -u EnvFile=/p4/common/bin/p4_vars if [[ -r "$EnvFile" ]]; then source "$EnvFile" hms else echo -e "\n\nERROR: The environment file $EnvFile is missing.\n\n" exit 1 fi # Override P4CONFIG to enhance environment isolation. export P4CONFIG=Undefined export P4ENVIRO=/dev/null/.p4enviro # Allow override of P4U_HOME, which is set only when testing P4U utility scripts. export P4U_HOME=${P4U_HOME:-$P4CBIN} export P4U_LIB=${P4U_LIB:-$P4CLIB} export P4U_ENV=$P4U_LIB/p4u_env.sh export P4U_LOG=Unset export HMS_HOME=${HMS_HOME:-/p4/common/hms} # Indicate whether we are called by the brokre wrapper. export HMS_CALLED_BY_WRAPPER=${HMS_CALLED_BY_WRAPPER:-0} # Load bash libs. declare BASH_LIBS=$P4U_ENV BASH_LIBS+=" $P4U_LIB/libcore.sh" BASH_LIBS+=" $P4U_LIB/libp4u.sh" BASH_LIBS+=" $HMS_HOME/lib/hms_load_and_verify.sh" for bash_lib in $BASH_LIBS; do source $bash_lib done export VERBOSITY=3 declare SiteTag=Unset declare -a InstanceName declare -a InstanceUserPorts declare -a InstanceMasterHost declare -a InstanceServerPort declare -a InstanceBrokerPort declare -a InstanceManaged declare -i InstanceCount=0 declare -a FailoverName declare -a FailoverType declare -a FailoverMasterHost declare -a FailoverBackupHost declare -a FailoverInstanceList declare -a FailoverDesc declare -i FailoverCount=0 declare -i SilentMode=0 declare Version=1.0.3 # A lexiographic compare is used to compare required vs. actual version of # the Helix Topology file. Helix Topology files define their version with 3 # digits, e.g. 3.0.0 or 3.0.1. The RequiredCfgVersion here must be defined # with two digits, e.g. "3.0" if "3.0.0" is good enough, since 3.0.0 is # lexiographically greater than 3.0. declare RequiredCfgVersion=1.0 #============================================================================== # Local Functions #------------------------------------------------------------------------------ # Function: terminate function terminate { # Disable signal trapping. trap - EXIT SIGINT SIGTERM # Don't litter. cleanTrash vvmsg "$THISSCRIPT: EXITCODE: $OverallReturnStatus" # Stop logging. [[ "${P4U_LOG}" == off ]] || stoplog # With the trap removed, exit. exit $OverallReturnStatus } #------------------------------------------------------------------------------ # Function: usage (required function) # # Input: # $1 - style, either -h (for short form) or -man (for man-page like format). #------------------------------------------------------------------------------ function usage { declare style=${1:--h} echo "USAGE for $THISSCRIPT v$Version: $THISSCRIPT {status|update|failover} [-L ] [-si] [-v] [-T] [-n] [-D] [-S] The *status*, *update*, and *failover* commands take additional arguments: status all | [:] update all | [:] upgrade all | [:] failover