#!/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
#------------------------------------------------------------------------------
export SDP_INSTANCE=${SDP_INSTANCE:-Undefined}
export SDP_INSTANCE=${1:-$SDP_INSTANCE}
if [[ $SDP_INSTANCE == Undefined ]]; then
echo "Instance parameter not supplied."
echo "You must supply the Perforce instance as a parameter to this script."
exit 1
fi
. /p4/common/bin/p4_vars $SDP_INSTANCE
. /p4/common/bin/backup_functions.sh
LOGFILE=$LOGS/p4verify.log
STATUS="OK: All scanned depots verified OK."
declare -i EXIT_CODE=0
P4="$P4BIN -p $P4PORT -u $P4USER"
/p4/common/bin/p4login
echo If there are errors in this log, contact support@perforce.com > $LOGFILE
verifyfailed=0
# Verify all depots of all types except 'remote' and 'archive'.
for d in `$P4 -s depots|grep "^info: Depot " |\
grep -v --perl-regexp "^info: Depot \S+ \d{4}\/\d{2}\/\d{2} (remote|archive|unload) " |\
cut -d ' ' -f 3`; do
echo === Started verify of //$d/... at $(date). >> $LOGFILE
if [[ "${P4REPLICA}" == "FALSE" || ${SHAREDDATA} == "TRUE" ]]; then
echo $P4 -s verify -qz //$d/... >> $LOGFILE
$P4 -s verify -qz //$d/... >> $LOGFILE 2>&1
if [[ $? -ne 0 ]]; then
verifyfailed=1
fi
else
echo $P4 -s verify -qz -t //$d/... >> $LOGFILE
$P4 -s verify -qz -t //$d/... >> $LOGFILE 2>&1
if [[ $? -ne 0 ]]; then
verifyfailed=1
fi
$P4 -s verify -qS //$d/... >> $LOGFILE 2>&1
if [[ $? -ne 0 ]]; then
verifyfailed=1
fi
fi
if [[ $verifyfailed -eq 1 ]]; then
STATUS="Error: Verify attempt failed. Review the log [$LOGFILE]."
EXIT_CODE=1
fi
done
for d in `$P4 -s depots| grep "^info: Depot " | grep --perl-regexp "^info: Depot \S+ \d{4}\/\d{2}\/\d{2} unload" | cut -d " " -f 3 `; do
echo === Started verify of //$d/... at $(date). >> $LOGFILE
if [[ "${P4REPLICA}" == "FALSE" || ${SHAREDDATA} == "TRUE" ]]; then
echo $P4 -s verify -U -q //$d/... >> $LOGFILE
$P4 -s verify -U -q //$d/... >> $LOGFILE 2>&1
else
echo $P4 -s verify -U -q -t //$d/... >> $LOGFILE
$P4 -s verify -U -q -t //$d/... >> $LOGFILE 2>&1
fi
if [[ $? -ne 0 ]]; then
STATUS="Error: Verify attempt failed. Review the log [$LOGFILE]."
EXIT_CODE=1
fi
done
if [[ $EXIT_CODE -eq 0 ]]; then
if [[ -n "$(grep BAD! $LOGFILE)" || -n "$(grep MISSING! $LOGFILE)" || -n "$(grep p4\ help\ max $LOGFILE)" ]]; then
STATUS="Warning: Verify errors detected. Review the log [$LOGFILE]."
EXIT_CODE=1
fi
fi
echo Completed verifications at $(date). >> $LOGFILE
mail_log_file "$HOSTNAME $P4SERVER P4Verify Log ($STATUS)"
exit $EXIT_CODE
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #37 | 33061 | C. Thomas Tyler |
Released SDP 2025.2.33059 (2026/07/21). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #36 | 32135 | C. Thomas Tyler |
Released SDP 2025.1.32133 (2025/10/29). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #35 | 31566 | C. Thomas Tyler |
Released SDP 2024.2.31564 (2025/05/14). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #34 | 30388 | C. Thomas Tyler |
Released SDP 2024.1.30385 (2024/06/11). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #33 | 30297 | C. Thomas Tyler |
Released SDP 2023.2.30295 (2024/05/08). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #32 | 30043 | C. Thomas Tyler |
Released SDP 2023.2.30041 (2023/12/22). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #31 | 29891 | C. Thomas Tyler |
Released SDP 2023.1.29699 (2023/07/11). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #30 | 29701 | C. Thomas Tyler |
Released SDP 2023.1.29699 (2023/07/11). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #29 | 29612 | C. Thomas Tyler |
Released SDP 2023.1.29610 (2023/05/25). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #28 | 29143 | C. Thomas Tyler |
Released SDP 2022.1.29141 (2022/10/29). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #27 | 28989 | C. Thomas Tyler |
Released SDP 2022.1.28987 (2022/08/25). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #26 | 28858 | C. Thomas Tyler |
Released SDP 2022.1.28855 (2022/05/27). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #25 | 28240 | C. Thomas Tyler |
Released SDP 2021.1.28238 (2021/11/12). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #24 | 27761 | C. Thomas Tyler |
Released SDP 2020.1.27759 (2021/05/07). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #23 | 27331 | C. Thomas Tyler |
Released SDP 2020.1.27325 (2021/01/29). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #22 | 25596 | C. Thomas Tyler |
Released SDP 2019.2.25594 (2019/05/02). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #21 | 25483 | C. Thomas Tyler |
Released SDP 2019.1.25480 (2019/04/11). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #20 | 25245 | C. Thomas Tyler |
Released SDP 2019.1.25238 (2019/03/02). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #19 | 24966 | C. Thomas Tyler | Adjusted version. | ||
| #18 | 24961 | Karl Wirth |
Fix for SDP-362. Move testing of variable till after the environment has been sourced. |
||
| #17 | 22185 | C. Thomas Tyler |
Released SDP 2017.2.22177 (2017/05/17). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #16 | 21244 | C. Thomas Tyler |
Released SDP 2016.2.21239 (2016/12/06). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #15 | 21035 | C. Thomas Tyler |
Released SDP 2016.2.21033 (2016/11/10). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #14 | 20997 | C. Thomas Tyler |
Released SDP 2016.2.20995 (2016/11/07). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #13 | 20974 | C. Thomas Tyler |
Released SDP 2016.2.20972 (2016/11/01). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
| #12 | 20353 | C. Thomas Tyler |
Released SDP 2016.1.20348. Copy Up using 'p4 copy -r -b perforce_software-sdp-dev', with selective removal of changes related to work-in-progress changes. |
||
| #11 | 19414 | C. Thomas Tyler | Released SDP/MultiArch/2016.1/19410 (2016/05/17). | ||
| #10 | 15856 | C. Thomas Tyler |
Replaced the big license comment block with a shortened form referencing the LICENSE file included with the SDP package, and also by the URL for the license file in The Workshop. |
||
| #9 | 15777 | C. Thomas Tyler |
No functional changes. Style Policing only on bash scripts only. Normalized indentation and line breaks, removed offending tabs, and general whitespace usage. |
||
| #8 | 13908 | C. Thomas Tyler | Pushing SDP 2015.1.13906. | ||
| #7 | 12938 | Russell C. Jackson (Rusty) | Adding a missing stderr redirect. | ||
| #6 | 12171 | Russell C. Jackson (Rusty) | Merge in changes to remove the need for p4master_run. | ||
| #5 | 11757 | Russell C. Jackson (Rusty) | Made the check for the unload depot more specific so it will only pick up an unload depot, and not depots with unload as part of the name or description. | ||
| #4 | 11707 | Robert Cowham |
Refactored sending of mail to a common function. Make the setting of "MAILFROM" work for Ubuntu (GNU Mailutils) as well as CentOS |
||
| #3 | 11570 | Russell C. Jackson (Rusty) |
Brought in changes from Mark Foundry to add -S $MAILFROM to mail commands. Changed sync_replica.sh and weekly_sync_replica.sh to use $LOGFILE for consistency. Added mail command to both files as well. |
||
| #2 | 11524 | Russell C. Jackson (Rusty) | Released updated version of the SDP from Dev. | ||
| #1 | 10148 | C. Thomas Tyler | Promoted the Perforce Server Deployment Package to The Workshop. |