p4verify.sh #14

  • //
  • guest/
  • perforce_software/
  • sdp/
  • dev/
  • Server/
  • Unix/
  • p4/
  • common/
  • bin/
  • p4verify.sh
  • View
  • Commits
  • Open Download .zip Download (9 KB)
#!/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

export SDP_ENV=/p4/common/bin/p4_vars
export SDP_INSTANCE=${SDP_INSTANCE:-Unset}

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

declare RecentChangesToVerify=${RECENT_CHANGES_TO_VERIFY:-2500}

declare StatusMessage="OK: All scanned depots verified OK."
declare -i VerifyOnlyRecentChanges=0
declare -i VerifyFailed=
declare -i ShowLog=0
declare -i ExitCode=0
declare RevRange=
declare VerifyCmd=
declare Log=Unset
declare version=5.0.1

#==============================================================================
# Local Functions

# Micro-functions, one-liners used to avoid external dependencies.
function msg () { if [[ $Log != Unset ]]; then echo -e "$*" >> $Log; else echo -e "$*"; fi; }
function cmd () { msg "$*" >> $Log; $* >> $Log 2>&1 ; return $?; }
function bail () { msg "\nError: ${1:-Unknown Error}"; exit ${2:-1}; }

#------------------------------------------------------------------------------
# Function: usage (required function)
#
# Input:
# $1 - style, either -h (for short form) or -man (for man-page like format).
# The default is -h.
#
# $2 - error message (optional).  Specify this if usage() is called due to
# user error, in which case the given message displayed first, followed by the
# standard usage message (short or long depending on $1).  If displaying an
# errror, usually $1 should be -h so that the longer usage message doesn't
# obsure the error message.
#
# Sample Usage:
# usage 
# usage -man
# usage -h "Incorrect command line usage."
#
# This last example generates a usage error message followed by the short
# '-h' usage summary.
#------------------------------------------------------------------------------
function usage
{
   declare style=${1:--h}
   declare errorMessage=${2:-Unset}

   if [[ $errorMessage != Unset ]]; then
      echo -e "\n\nUsage Error:\n\n$errorMessage\n\n" >&2
   fi

   echo "USAGE for p4verify.sh v$Version:

p4verify.sh [<instance>] [-recent]

   or

p4verify.sh -h|-man
"
   if [[ $style == -man ]]; then
      echo -e "DESCRIPTION:

	This script performs a 'p4 verify' of all submitted and shelved versioned
	files in depots of all types except 'remote' and 'archive' type depots.

	If run on a replica, it schedules archive failures for transfer to the
	replica.

OPTIONS:
<instance>
	Specify the SDP instances.  If not specified, the SDP_INSTANCE
	environment variable is used instead.  If the instance is not
	defined by a parameter and SDP_INSTANCE is not defined, p4verify.sh
	exists immediately with an error message.

 -recent
	Specify that only recent changelists should be verified.
	The \$SDP_RECENT_CHANGES_TO_VERIFY variable defines how many
	changelists are considered recent; the default is $RecentChangesToVerify.

	If the default is not appropriate for your site, add
	\"export SDP_RECENT_CHANGES_TO_VERIFY\" to /p4/common/config/p4_N.vars to
	change the default for an instance, or to /p4/common/bin/p4_vars to
	change it globally.  If unset, the default is $RecentChangesToVerify.

 -v     Show ouptput of verify attempts, which is suppressed by default.
	Setting SDP_SHOW_LOG=1 in the shell environment has the same
	effect as -v.

 -L <log>
	Specify the log file to use.  The default is /p4/N/logs/p4verify.log

 -D     Set extreme debugging verbosity.

HELP OPTIONS:
 -h	Display short help message
 -man	Display man-style help message

EXAMPLES:
	This script is typically called via cron with only the instance
	paramter as an argument, e.g.:
	p4verify.sh N

LOGGING:
	This script generates no output by default.  All (stdout and stderr) is
	logged to /p4/N/logs/p4verify.log.

	The exception is usage errors, which result an error being sent to
	stderr followed usage info on stdout, followed by an immediate exit.

	If the '-v' flag is used, the contents of the log are displayed to
	stdout at the end of processing.

EXIT CODES:
	An exit code of 0 indicates no errors were encounted attempting to
	perform verifications, AND that all verifications attempted
	reported no problems.

	A exit status of 1 indicates that verifications could not be
	attempted for some reason.

	A exit status of 2 indicates that verifications were successfully
	performed, but that problems such as BAD or MISSING files
	were detected, or else system limits prevented verification.
"
   fi

   exit 1
}

#------------------------------------------------------------------------------
# Function: get_verify_rev_range ($depot, $recentChanges)
#------------------------------------------------------------------------------
function get_verify_rev_range () {
   declare depot=${1:-}
   declare recentChangesToVerify=${2:-}
   declare nowChange=
   [[ -z "$depot" || -z "$recentChangesToVerify" ]] && return 0

   nowChange=$($P4 -ztag -F %change% changes -m 1 $depot/...)
   thenChange=$($P4 -ztag -F %change% changes -m $recentChangesToVerify $depot/... | tail -1)
   [[ -z "$nowChange" ]] && return 1
   [[ -z "$thenChange" ]] && return 1

   echo "@$thenChange,@$nowChange"

   return 0
}

#==============================================================================
# Command Line Processing

declare -i shiftArgs=0

set +u
while [[ $# -gt 0 ]]; do
   case $1 in
      (-h) usage -h;;
      (-man) usage -man;;
      (-recent) VerifyOnlyRecentChanges=1;;
      (-v) ShowLog=1;;
      (-L) Log=$2; shiftArgs=1;;
      (-D) set -x;; # Debug; use 'set -x' mode.
      (-*) usage -h "Unknown command line option ($1).";;
      (*) export SDP_INSTANCE=$1;;
   esac

   # Shift (modify $#) the appropriate number of times.
   shift; while [[ $shiftArgs -gt 0 ]]; do
      [[ $# -eq 0 ]] && usage -h "Incorrect number of arguments."
      shiftArgs=$shiftArgs-1
      shift
   done
done
set -u

#==============================================================================
# Command Line Verification

[[ $SDP_INSTANCE == Unset ]] && \
   bail "The \$SDP_INSTANCE setting is not defined. It must be defined by doing:\n\n\tsource /p4/common/bin/p4_vars <instance>\n\nor by passing in the instance name as a parameter to this script.\n"

#==============================================================================
# Main Program

source $SDP_ENV $SDP_INSTANCE ||\
   bail "Failed to load SDP environment for instance $SDP_INSTANCE."

source $P4CBIN/backup_functions.sh ||\
   bail "Failed to backup_functions.sh."

[[ $Log == Unset ]] && Log=$LOGS/p4verify.log

rm -f "$Log"

msg "${0##*/} v$Version Starting verify at $(date +'%a %Y-%m-%d %H:%M:%S %Z')."

P4="$P4BIN -p $P4PORT -u $P4USER"
$P4CBIN/p4login

msg "If there are errors in this log, contact support@perforce.com"

VerifyFailed=0

if [[ $VerifyOnlyRecentChanges -eq 1 ]]; then
   RevRange=$(get_verify_rev_range "$d" "$RECENT_CHANGES_TO_VERIFY")
else
   RevRange=
fi

# 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
   msg "=== Started verify of //$d/... at $(date)."

   if [[ "${P4REPLICA}" == "FALSE" || ${SHAREDDATA} == "TRUE" ]]; then
      VerifyCmd="$P4 -s verify -qz //$d/...$RevRange"
      cmd $VerifyCmd || VerifyFailed=1

      VerifyCmd="$P4 -s verify -qS //$d/...$RevRange"
      cmd $VerifyCmd || VerifyFailed=1
   else
      VerifyCmd="$P4 -s verify -qz -t //$d/...$RevRange"
      cmd $VerifyCmd || VerifyFailed=1

      VerifyCmd="$P4 -s verify -qS -t //$d/...$RevRange"
      cmd $VerifyCmd || VerifyFailed=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
   msg "=== Started verify of //$d/... at $(date)."
   if [[ "${P4REPLICA}" == "FALSE" || ${SHAREDDATA} == "TRUE" ]]; then
      VerifyCmd="$P4 -s verify -U -q //$d/...$RevRange"
      cmd $VerifyCmd || VerifyFailed=1
   else
      VerifyCmd="$P4 -s verify -U -q -t //$d/...$RevRange"
      cmd $VerifyCmd || VerifyFailed=1
   fi
done

if [[ $VerifyFailed -ne 0 ]]; then
   StatusMessage="Error: Verify attempt failed.  Review the log [$Log]."
   ExitCode=1
fi

if [[ $ExitCode -eq 0 ]]; then
   egrep '(BAD!|MISSING!|p4 help max)' $Log > /dev/null 2>&1
   if [[ $? -eq 0 ]]; then
      StatusMessage="Warning: Verify errors detected.  Review the log [$Log]."
      ExitCode=2
   fi
fi
 
msg "Completed verifications at $(date)."

mail_log_file "$HOSTNAME $P4SERVER P4Verify Log ($StatusMessage)"

[[ $ShowLog -eq 1 && -s $Log ]] && cat $Log
 
exit $ExitCode
# Change User Description Committed
#76 32375 Charles MacGregor Adding support for p4verify to only verify submitted files and specs submitted after a given datetime.
(or a number of days/weeks/months ago)

Two new options have been added, '-since' and '-last'
'-since' accepts a date/datetime in the form YYYY/MM/DD:HH:MM:SS which will be used as the start day for the range being verified.
'-last' accepts a human readable description of the rage, i.e. '2 weeks' this will suffixed with 'ago' and passed to `date -d` to interpret into a datetime.

If either option is supplied to p4verify.sh the p4 verify command is run against a revision range starting at the datetime provided and ending at the current time e.g.
'@2025/12/01:09:00:00,@now' if "2025/12/01:09:00:00" was passed as -since.
or
'@2025/12/05:12:00:00,@now' if it was run at 12:00:00 on 2025/01/05 with -last "1 month"

#review
#75 32100 C. Thomas Tyler In p4verify.sh, adjusted exit code for '-h/-man' opertions to 2 rather than 1.

Added tests for p4verify.sh to cli_tests.cfg.

Updated scan for unreported errors in 'r' script to ignore known-harmless text
chunks like 'LOGGING:', 'NOTIFICATIONS:', and 'TIMING:'.

Fixed typo in comment in scripted_tests.cfg.
#74 32094 C. Thomas Tyler Updated VerifyCmd to use array rather string to achieve desired
handling of complex quoting while avoding using 'eval'.
#73 32087 C. Thomas Tyler Tweak to order of local vs.
standard library function load order.
#72 32078 C. Thomas Tyler Fixed quoting issue if depot name contains funky characters like '('.

Fixes SDP-1307.
#71 32077 C. Thomas Tyler Internal refactoring.
#70 32044 C. Thomas Tyler Slow Refactoring: "Moving" log_functions.sh from bin to lib directory,
and changing to .lib extension per coming SDP Coding Standard for bash.

The "slow refactoring" means for this change, the original log_functions.sh
will remain in the bin directory, and a new logging.lib file will be added
in the lib directory.  The removal of the file in bin will occur separately.
This is intended to balance allowing progress while preventing potential
disruption to customers who may have supplemental automation relying on the
current names.

New libs: ps.lib, logging.lib, run.lib

We may also allow legacy exceptions since customer-side custom scripts may
have dependencies on backup_functions.sh and other *.sh libraries in the bin
directory.

Unrelated minor fixes in p4verify.sh.
#69 31867 C. Thomas Tyler Added support for new 'head' value to '-recent=' parameter.
 Now
'-recent=head' can be specified to verify only head revisions.

This is expected to be particularly useful for edge servers to pull
head revisions only, but will be useful in other scenarios.

Docs are updated accordingly.

Shellcheck OK.

Fixes: SDP-1296

#review-31868
#68 31819 C. Thomas Tyler p4verify.sh: Removed redundant output when there are no shelves to verify.
#67 31512 C. Thomas Tyler Fixed quoting bug.
#66 31510 C. Thomas Tyler p4verify.sh: Minor fix to logic attempting to cleanup depot list files,
to be more robust with suboptimal user input and to eliminate this
possible error:

grep: warning: stray \ before #
#65 31439 C. Thomas Tyler Tweak to allow a user of type operator to be used with '-p4config'.
#64 30344 C. Thomas Tyler Fixed typo in usage synopsis.
#63 30272 C. Thomas Tyler Added '-p4config' option to verify an arbitrary p4d server, maybe non-SDP
and non-Linux.

Changed mechansim for checking P4D_VERSION to use 'p4 info' rather than
'p4d -V' output, so as to work for local and remote servers.

Added warnings for short-duration tickets.

Added early abort if user does not have admin or better access (as is
required for running 'p4 verify').
#62 30261 C. Thomas Tyler p4verify.sh: Fixed bug that caused duplicate emails to be sent.

#review-30262
#61 30255 C. Thomas Tyler Added '-a' to all grep commands.

#review-30256
#60 30251 C. Thomas Tyler p4verify.sh: Added '-no_z' option to verify without '-z'.

Removed restriction on using '-recent' with '-nr'. It is
useful to verify recent shelves.

#review-30252
#59 30156 C. Thomas Tyler p4verify.sh v5.16.2: Doc fixes, no functional change.

Thanks, Andrei!
#58 30141 C. Thomas Tyler p4verify.sh: For shelved files that fail verify, show the command line that generated the error.
#57 29992 C. Thomas Tyler p4verify.sh: Added support for handling the 'trait' depot (new in 2023.2).

Refactored get_old_log_timestamp() function, moving it from
backup_functions.sh into new log_functions.sh file.

#review-29993
#56 29861 C. Thomas Tyler p4verify.sh v5.15:
* The '-paths' and '-recent' options can now be used together, so recent
files in specified paths can be verified.  Particularly useful for edge
servers and failover scenarios where earlier and more thorough vetting
has been done.
* The '-recent' now sports an optional '-recent=N' syntax to specify # of revs.
* Doc updates for above.
* Fixed minor ShellCheck compliance issues.

#review-29862
#55 29827 C. Thomas Tyler Added support for verifying the Extensions depot.

#review-29828 @robert_cowham
#54 29717 C. Thomas Tyler p4verify.sh: Cosmetic issue in 'Time:' output in p4verify.log.
#53 29689 C. Thomas Tyler Slight tweak to new '-ignores' option introduced in @29655.

Added concept of a standard ignores file; if it exists in
expected path, '-ignores' option is not needed.  Can use
'-ignores none' to avoid processing any ignores.

Ignores output clearly indicates whether errors were ignored.

Improved docs for ignores as well.

#review-29690
#52 29655 C. Thomas Tyler p4verify.sh v5.13.0:
* Added '-ignores <regex_file_pattern>' option to ignore known errors.
* Corrected issues with summary of messages in summary log file.
* Changed call_p4verify() function name to call_p4_verify() to more
clearly indicate that the underlying 'p4' command line is called.
* Fixed cosmet tab/space errors.

#review-29656
#51 29633 C. Thomas Tyler Added '-paths' option to specify a file containing a list of paths to
verify.  Can be combined with '-chunks' or used independently.

Enhanced timing detail, and made it easier to extract timing detail
with soemthing like:

grep ^Time: /p4/1/logs/p4verify.log

Added docs for above, and also did some general cleanup of docs.

#review-29634
#50 29586 C. Thomas Tyler Added safety feature to avoid processing cache mode replica.

Added '-Ocache' override option to bypass the safety feature.

Added relevant docs.
#49 29580 C. Thomas Tyler Added check for bash v4+.
#48 29578 C. Thomas Tyler Fixed issue with log rotation login on some platforms.

#review-29579 @Domenic
#47 29577 C. Thomas Tyler Added usage exmple for archive loading with delay.
#46 29570 Andy Boutte Enhance p4verify to utilize die() function which will allow user to leverage AWS SNS or PagerDuty.
Added '-N' option to notify only in event of failure.
#45 29559 C. Thomas Tyler Added '-Q <MaxTotalPullQueueSize>' option.
Fixed bugs from earlier review, 29555.

#review-29560 @robert_cowham
#44 29554 C. Thomas Tyler Added '-w <Wait>' and '-q <MaxActivePullQueueSize>' options to p4verify.sh.

#review-29555
#43 29106 C. Thomas Tyler Split p4verify.log into full and summary logs, with summary sent to
AWS SNS if configured.  Summary is always sent via email, referencing
log on host.

Added rough counts of verify errors of various types to summary.

Docs: Added more examples with more complete information.

Enhanced general log file handling.

Fixed a minor bug in suppression of 'no such file' errors.

Enhanced internal code comments.

Bypassing pre-commit review to engage test suite.

#review-29025 @andy_boutte
#42 28977 C. Thomas Tyler Fixed bug found in review.

#review-28975
#41 28974 C. Thomas Tyler Fixed bug with P4D_VERSION unbound variable if '-o MISSING'
is used and SDP shell environment has not been sourced.

The script sourced p4_vars to set P4D_VERSION, but too late,
after P4D_VERSION was referenced. This has been fixed.

Moved cmd() function to be in the 'Local Functions' section
of the file.

#review-28975
#40 28835 C. Thomas Tyler p4verify.sh v5.6.2:
* Added '-dlf <depot_list_file>' option to specify prioritized list
of depots to process.
* Added '-chunks', useful for avoiding RAM exhaustion. Uses the
depot_verify_chunks.py option to verify depots in chunks. Testing
indicates this may be much slower than a standard verify, but can
be a useful option if RAM is scarce. If used, this introduces
a dependency on the perforce-p4python3 package.
* Optimized options to 'p4 verify' on a per-depot basis, e.g.
not applying '-z' in depot types that can't have lazy copies.
* Eliminated the "on replica" portion of a message displayed on some
verify commands, as it had become potentially inaccurate with
introduction of the '-nt' option.
* Added 'Processing N depots' message.

To Do: The verify_depot_chunks.py sometimes lists empty
paths, e.g. //MyDepot/Binaries/*, which could be
eliminated if empty. This is mostly harmless but results
in some cruft in the log.
#39 28771 C. Thomas Tyler Changed email address for Perforce Support.

#review-28772 @amo @robert_cowham
#38 28211 C. Thomas Tyler p4verify.sh v5.4.0:
* Added '-o BAD|MISSING' to expose the p4d '--only BAD|MISSING' option.
* Fix: Completed implementation of documented '-a' option.
* Added '-nt' option to avoid passing '-t' to 'p4 verify' on replicas.
* Reduced excess noise from change-by-change verification of shelves.

Bypassing pre-commit to engage test suite.

#review-28212
#37 28143 C. Thomas Tyler Fixed issue operating in environments where the shell USER variable is not
defined. The current USER is now determined with 'id -n -u'.

Also silenced a harmless ShellCheck warning.

#review-28144
#36 27722 C. Thomas Tyler Refinements to @27712:
* Resolved one out-of-date file (verify_sdp.sh).
* Added missing adoc file for which HTML file had a change (WorkflowEnforcementTriggers.adoc).
* Updated revdate/revnumber in *.adoc files.
* Additional content updates in Server/Unix/p4/common/etc/cron.d/ReadMe.md.
* Bumped version numbers on scripts with Version= def'n.
* Generated HTML, PDF, and doc/gen files:
  - Most HTML and all PDF are generated using Makefiles that call an AsciiDoc utility.
  - HTML for Perl scripts is generated with pod2html.
  - doc/gen/*.man.txt files are generated with .../tools/gen_script_man_pages.sh.

#review-27712
#35 27616 C. Thomas Tyler Corrected p4verify.sh doc error implying multiple instances
can be processed in a single invocation. Also fixed a shellcheck
warning.

Non-functional change.
#34 27216 C. Thomas Tyler Non-functional change: Fixed a common doc type:
paramter -> parameter
#33 27107 C. Thomas Tyler Reworked how shelved files are verified.

If shelved files are to be verified, shelved changelists are processed
rather than verifying by association with depots. This now complies
with documented restriction per 'p4 help verify' that only the @=
revision specifier is valid when the '-S' flag is used.

If '-recent' is specifed, only the most recent N shelved changelists
are verified.

#review-27108
#32 26847 Robert Cowham Put back the include tags for AsciiDoc
#31 26815 C. Thomas Tyler Patch: Fixed bug in '-recent' flag to p4verify.sh.
#30 26755 Robert Cowham Include p4verify.sh man page in SDP Guide automatically for usage section.
#29 25547 C. Thomas Tyler p4verify.sh v5.2.0:

Added targeting flags:
-nu - No Unload
-nr - No Regular archived files.
-ns - No Spec Depot
-nS - No Shelved
-a  - Archive Depot verify.

Verification of archive depots with '-A' is now supported,
though not enabled by default as archive depots are typically
in cold storage.

Also made doc tweaks, enhanced description of '-L' flag and
correcting '-h' usage.

Added warning message if an unknown depot type is encountered.
Unknown depot types are ignored, as new depot types typically
require new logic to handle.

More updates for shellcheck compliance.
#28 25452 C. Thomas Tyler Bumped Version ID for change @25451.
#27 25451 Robert Cowham Fix failing test - local cmd function was being overwritten by sourcing backup_functions.sh
#26 25238 C. Thomas Tyler Replaced references to /tmp with P4TMP (e.g.
/p4/N/tmp) to avoid
issues with SELinux incompatibility.

For p4verify.sh, enhanced:
* Minor performance enhancement: Added '-m1' flag to egrep that
  determines whether to exit code with non-zero, as we only need
  to detect one occurence.
* Changed 'Warning:' to 'Error:' if verify errors are detected.
* Removed redundant check that SDP_INSTANCE is set.
* Added total time info.
* Adjusted to pass 'shellcheck.sh' check.

#review-25239
#25 24967 C. Thomas Tyler Merged patch fix from Karl in main to dev.
#24 24218 C. Thomas Tyler Enhanced performance of "p4 verify.sh -recent" by lowering
default changelists to scan per depot, and skipping shelves.

Also fixed indentation/style issues.
#23 23750 C. Thomas Tyler In p4verify.sh, fixed handling of unload and spec depots.

Unload depots were not being identified correctly, and so special flags
needed for unload-type depots were not applied.

For spec-type depots, 'p4 verify -qS' was run, which isn't necessary or
helpful since it is not possible to shelve files in the spec depot.

The fix included replacing parsing logic with optimized p4 commands that
don't require parsing.
#22 22074 Russell C. Jackson (Rusty) Corrected the name of the variable.
Already reviewed with Tom.
#21 22066 Russell C. Jackson (Rusty) Added rotate for p4verify.log instead of just deleting the prior one.
#20 21233 Russell C. Jackson (Rusty) Review 21010 from Adrian commit.
#19 21007 adrian_waters Fix specification of depot path in get_verify_rev_range when -recent used
#18 20995 C. Thomas Tyler Style tweak; using double-square brakets rather than single-square
brackets.
#17 20994 adrian_waters Refactor around changes to support -recent arg - had broken code even where -recent not used because of unbounded variable ($d);  use of the -recent option also fails as 'verify -S' not valid for shelved files (only @= is supported) ;  stripping out archive,unload+remote depots also not working + get_verify_rev_range used depot name incorrectly in changes (eg, changed -m 1 depot/...
rather than //depot/...)

Raised  job000634 for changes.

Further aim is to modify script for depots with no shelved files does not result in an 'error' line being written to p4verify.log - it confuses clients - will do that as a separate change.
#16 20909 Russell C. Jackson (Rusty) Fixed missing LOGFILE variable issue.
#15 20879 Robert Cowham Fix typo in variable name.
#14 20868 C. Thomas Tyler Add '-recent' flag to p4verify.sh to verify only recent changes.

Usage info is added with '-h' and '-man' flags.

This change involved changing the command line parsing to accept
the <instance> positional parameter and '-recent' flag, as well
as standard '-v' and '-D' flags.

This change also should reduce memory requirement in cases where
there are a large number of verify errors.  This was done by
combining greps and tossing 'grep' output to /dev/null, using only
the grep exit code to determine if BAD/MISSING (etc.) appear in the
log.

Added a Version id.  (Need to avoid +k due to the way SDP files
move around from server to server).  This must be updated manually.
#13 20086 Russell C. Jackson (Rusty) Added -t to verify of shelves on a replica, and added verify of shelves on the master.
#12 20083 Russell C. Jackson (Rusty) Added missing echo of command into log file.
#11 19314 Russell C. Jackson (Rusty) Change p4verify.sh to use -S to verify shelves on a replica instead of printing the files
on the shelf.

Removed the HOST_IP settings from mkdirs and instance_vars since it causes problems in
a shared depotdata environment, and it was a temporary fix to work around a bug with
auth.id that is being fixed.
#10 19102 Russell C. Jackson (Rusty) Added check for SHAREDDATA to avoid using -t on a shared data volume replica.
Allows running verify on the replica instead of the master.
#9 16029 C. Thomas Tyler Routine merge to dev from main using:
p4 merge -b perforce_software-sdp-dev
#8 15778 C. Thomas Tyler Routine Merge Down to dev from main.
#7 13906 C. Thomas Tyler Normalized P4INSTANCE to SDP_INSTANCE to get Unix/Windows
implementations in sync.

Reasons:
1. Things that interact with SDP in both Unix and Windows
environments shoudn't have to account for this obscure
SDP difference between Unix and Windows.  (I came across
this doing CBD work).

2. The Windows and Unix scripts have different variable
names for defining the same concept, the SDP instance.
Unix uses P4INSTANCE, while Windows uses SDP_INSTANCE.

3. This instance tag, a data set identifier, is an SDP concept.
I prefer the SDP_INSTANCE name over P4INSTANCE, so I prpose
to normalize to SDP_INSTANCE.

4. The P4INSTANCE name makes it look like a setting that might be
recognized by the p4d itself, which it is not.  (There are other
such things such as P4SERVER that could perhaps be renamed as
a separate task; but I'm not sure we want to totally disallow
the P4 prefix for variable names. It looks too right to be wrong
in same cases, like P4BIN and P4DBIN.  That's a discussion for
another day, outside the scope of this task).

Meanwhile:
* Fixed a bug in the Windows 2013.3 upgrade script that
was referencing undefined P4INSTANCE, as the Windows
environment defined only SDP_INSTANCE.

* Had P4INSTANCE been removed completely, this change would
likely cause trouble for users doing updates for existing
SDP installations.  So, though it involves slight technical debt,
I opted to keep a redundant definition of P4INSTANCE
in p4_vars.template, with comments indicating SDP_INSTANCE should be
used in favor of P4INSTANCE, with a warning that P4INSTANCE
may go away in a future release.  This should avoid unnecessary
upgrade pain.

* In mkdirs.sh, the varialbe name was INSTANCE rather than
SDP_INSTANCE.  I changed that as well.  That required manual
change rather than sub/replace to avoid corrupting other similar
varialbe names (e.g.  MASTERINSTANCE).

This is a trivial change technically (a substitute/replace, plus
tweaks in p4_vars.template), but impacts many files.
#6 13586 C. Thomas Tyler Routine merge down from main -> dev.
Trivial merges, all resolved with 'p4 resolve -as.'
#5 12169 Russell C. Jackson (Rusty) Updated copyright date to 2015

 Updated shell scripts to require an instance parameter to eliminate the need
 for calling p4master_run.    Python and Perl still need it since you have to set the
environment for them to run in.

 Incorporated comments from reviewers. Left the . instead of source as that seems
more common in the field and has the same functionality.
#4 12028 C. Thomas Tyler Refreshed SDP dev branch, merging down from main.
#3 11485 Russell C. Jackson (Rusty) Brought over changes from RCJ sdp to properly handle Edge servers
 and to properly replicate shelves when replicating from Windows to Linux
#2 11476 Russell C. Jackson (Rusty) Fixed echo command to match the actual command run.
#1 10638 C. Thomas Tyler Populate perforce_software-sdp-dev.
//guest/perforce_software/sdp/main/Server/Unix/p4/common/bin/p4verify.sh
#1 10148 C. Thomas Tyler Promoted the Perforce Server Deployment Package to The Workshop.