#!/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
#------------------------------------------------------------------------------

set -e
instance=${1}
if [ ! -d /p4/${instance} ]; then
  exit 0 
fi
shift
source /p4/common/bin/p4_vars $instance
source /p4/common/bin/backup_functions.sh
set_vars

if [[ "${SERVER_TYPE}" == "p4proxy" ]]; then
   exit 0
fi

if [[ "${P4REPLICA}" == "TRUE" ]] && [[ $EDGESERVER -eq 0 ]]; then
   exec $@
fi
