#!/usr/bin/env 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
#------------------------------------------------------------------------------
instance=${1}
if [ ! -d /p4/${instance} ]; then
exit 0
fi
shift
# Load SDP environment functions
source /p4/common/bin/p4_vars "$instance"
source /p4/common/bin/backup_functions.sh
# List of variables that must be set before continuing
required_vars=(SERVER_TYPE P4REPLICA EDGESERVER)
check_vars() {
local missing=0
for v in "${required_vars[@]}"; do
if [[ -z "${!v}" ]]; then
echo "Missing required variable: $v"
missing=1
fi
done
return $missing
}
# --- First check ---
check_vars
if [[ $? -ne 0 ]]; then
echo "Calling set_vars to initialize missing variables..."
set_vars
fi
# --- Check again after set_vars ---
check_vars
if [[ $? -ne 0 ]]; then
echo "ERROR: Required variables are still missing after calling set_vars."
exit 1
fi
# --- Script logic now safe to execute ---
if [[ "${SERVER_TYPE}" == "p4proxy" ]]; then
exit 0
fi
if [[ "${SERVER_TYPE}" == "p4d_standby" || "${SERVER_TYPE}" == "p4d_edgerep" ]]; then
exec "$@"
fi
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #13 | 32426 | Russell C. Jackson (Rusty) | Claude ai updates. | ||
| #12 | 32388 | Russell C. Jackson (Rusty) | Updates using Claude.ai to clean up the code, reduce duplication, enhanace security, and use current standards. | ||
| #11 | 32364 | Russell C. Jackson (Rusty) | Forgot about p4d_edgerep type | ||
| #10 | 32349 | Russell C. Jackson (Rusty) | Changed to use SERVERTYPE for checks. | ||
| #9 | 32346 | Russell C. Jackson (Rusty) | Changed logic to only call set_vars if the variables are missing. | ||
| #8 | 31923 | Russell C. Jackson (Rusty) | Removing set -x | ||
| #7 | 24116 | Russell C. Jackson (Rusty) | Added check for proxy server. | ||
| #6 | 24078 | Russell C. Jackson (Rusty) |
Added check to see if directory exists. Exit silently if not. |
||
| #5 | 22981 | Russell C. Jackson (Rusty) | Made files writeable so they are easier to update once on the server. | ||
| #4 | 22799 | Russell C. Jackson (Rusty) |
Removed () from set_vars call. Cut and paste mistake. |
||
| #3 | 22719 | Russell C. Jackson (Rusty) | Added call to source backup_functions.sh and run set_vars. | ||
| #2 | 22718 | Russell C. Jackson (Rusty) | Added check to make sure we are not on an edge server. | ||
| #1 | 22693 | Russell C. Jackson (Rusty) |
Branched a Unix only version of the SDP. Removed extra items to create a cleaner tree. Moved a few items around to make more sense without Windows in the mix. |
||
| //guest/perforce_software/sdp/dev/Server/Unix/p4/common/bin/run_if_replica.sh | |||||
| #1 | 22686 | Russell C. Jackson (Rusty) | Two small scripts to allow using a single crontab for all servers by putting all the entries into one file and only running based on server type. | ||