USAGE for verify_sdp.sh v5.34.0:

verify_sdp.sh [<instance>] [-online] [{-skip,-warn,-extra,-only} <test>[,<test2>,...]] [-skip_summary] [-c|-csec] [-si] [-L <log>|off ] [-d|-D]

   or

verify_sdp.sh -h|-man

DESCRIPTION:

	This script verifies the current SDP setup for the specified instance,
	and also performs basic health checks of configured servers.

	This uses the SDP instance bin directory /p4/N/bin to determine
	what server binaries (p4d, p4broker, p4p) are expected to be configured
	on this machine.

	Existence of the '*_init' script indicates the given binary is
	expected. For example, for instance 1, if /p4/1/bin/p4d_1_init
	exists, a p4d server is expected to run on this machine.

	Checks may be executed or skipped depending on what servers are
	configured. For example, if a p4d is configured, the $P4ROOT/server.id
	file should exist. If p4p is configured, the 'cache' directory
	should exist.

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,
	exits immediately with an error message.

 -online
	Online mode.  Does additional checks that expect p4d, p4broker,
	and/or p4p to be online. Any servers for which there are
	*_init scripts in the Instance Bin directory are checked.  An
	error is reported if p4d is expected to be online and is not;
	warnings are displayed if p4broker or p4p are not online.
	The Instance Bin directory is the /p4/N/bin directory, where N
	is the SDP instance name.

 -c	Specify '-c' to call ccheck.sh to compare configurables, using
	the default config file: /configurables.cfg

	See 'ccheck.sh -man' for more information.

	This option can only be used in Online mode; if '-c' is specified,
	'-online' is implied.

 -csec
	Specify '-csec' to call ccheck.sh checking only for security
	settings.

	This option can only be used in Online mode; if '-csec' is
	specified, '-online' is implied.

 -skip <test>[,<test2>,...]

	Specify a comma-delimited list of named tests to skip.
	
	Valid test names are:

	* cron|crontab: Skip crontab check. Use this if you do not expect crontab to
	be configured, perhaps if you use a different scheduler.
	* excess: Skip checks for excess copies of p4d/p4p/p4broker in PATH.
	* init: Skip compare of init scripts w/templates in /p4/common/etc/init.d
	* license: Skip license related checks.
	* commitid: Skip check ensuring ServerID of commit starts with 'commit' or 'master'.
	* masterid: Synonym for commitid.
	* offline_db: Skip checks that require a healthy offline_db.
	* owner: Skip checks that require ownership of specific files/folders.
	* p4root: Skip checks that require healthy P4ROOT db files.
	* p4t_files: Skip checks for existence of P4TICKETS and P4TRUST files.
	* passwd|password: Skip SDP password checks.
	* version: Skip version checks.

	As an alternative to using the '-skip' option, the shell environment
	variable VERIFY_SDP_SKIP_TEST_LIST can be set to a comma-separated
	list of named tests to skip.  Using the command line parameter is the
	best choice for temporarily skipping tests, while specifying the
	environment variable is better for making permanent exceptions (e.g.
	always excluding the crontab check if crontabs are not used at this
	site).  The variable should be set in /p4/common/config/p4_N.vars.

	If the '-skip' option is provided, the VERIFY_SDP_SKIP_TEST_LIST
	variable is ignored (not appended to). So it may make sense to
	reference the variable on the command line. For example, if the
	value of the variable is 'crontab', to skip crontab and license
	checks, you could specify:

	-skip $VERIFY_SDP_SKIP_TEST_LIST,license

	The '-skip' option can be used with '-warn' and '-extra', but is
	mutually exclusive with '-only'.

 -warn <test>[,<test2>,...]
	Specify a comma-delimited list of named tests that will be reported
	as warnings rather than errors.

	The list of valid test names as the same as for the '-skip' option.

	As an alternative to using the '-warn' option, the shell environment
	variable VERIFY_SDP_WARN_TEST_LIST can be set to a comma-separated
	list of name tests to skip.  Using the command line parameter is the
	best choice for temporarily converting errors to warnings, while
	specifying the environment variable is better for making the
	conversion to warnings permanent.  The variable should be set in
	/p4/common/config/p4_N.vars file.

	If the '-warn' option is provided, the VERIFY_SDP_WARN_TEST_LIST
	variable is ignored (not appended to). So it may make sense to
	reference the variable on the command line. For example, if the
	value of the variable is 'crontab', to convert to warnings for
	crontab and excess binaries tests, you could specify:

	-warn $VERIFY_SDP_WARN_TEST_LIST,excess

	The '-warn' option can be used with '-skip' and '-extra', but is
	mutually exclusive with '-only'.

 -extra <test>[,<test2>,...]

	Some tests are not executed by default, but are instead invoked
	only on request with the '-extra' option.  The following tests
	are executed if specified with the '-extra' option:

	* commit_defined
	* protections
	* remote_disabled
	* server_type_known
	* systemd_config
	* all (short for all of the above)

	commit_defined: Do a test to check defined server specs, and
	ensure that exactly one server spec has a 'Services' field value
	of 'commit-server', and that no server specs are defined with a
	'Services' field value of 'standard' (the obsolete predecessor to
	'commit-server').  This test requires p4d to be online and thus
	implies '-online'.

	protections: Do sanity check on the Protections table:
	* Ensure the last line of the Protections table starts with:
	'super user <P4USER>'.

	remote_disabled: This test ensures the legacy built-in user'remote'
	is disabled.  Any one of the following must be true to pass this
	check:
	* P4D version is 2025.1+
	* security=4
	* A 'p4 protects -u remote' lists nothing but exclusionary mappings.

	server_type_known: Do a test to confirm that exactly one of
	run_if_master.sh, run_if_replicas.sh, and run_if_edge.sh returns
	true. If 0 or more than 1 are true, report that as an error.

	systemd_config: Check the systemd service configuration. This
	checks that:
	* Appropriate system services (p4d/p4broker/p4p) are defined
	corresponding init scripts existing in the Instance Bin directory,
	/p4/N/bin.
	* The p4d_N service, if defined, matches the template.
	* The p4broker_N service, if defined, matches the template.
	* The p4p_N service, if defined, matches the template.

	The '-extra' option can be used with '-skip' and '-warn', but is
	mutually exclusive with '-only'.

 -only <test>[,<test2>,...]
	Use the '-only' option to execute only specified tests.  If this
	option is used, even tests that cannot be skipped with '-skip'
	and thus are usually always executed are not executed.  This
	option is primarily intended to support testing of verify_sdp.sh.

	Only a limited set of tests can be specified with '-only', including:

	* crontab
        * commit_defined
	* commitid
	* excess
        * protections
        * remote_disabled
        * server_type_known
        * systemd_config
	* version

	The '-only' option is mutually exclusive with '-skip', '-warn',
	and '-extra'.

 -skip_summary
	By default, if any errors or warnings are displayed in the output,
	a summary of those errors appears at the end.  Specify this
	option to avoid displaying the summary at the end.

 -si	Silent mode, useful for cron operation.  Both stdout and stderr
	are still captured in the log.  The '-si' option cannot be used
	with '-L off'.

 -L <log>
	Specify the log file to use.  The default is /p4/N/logs/verify_sdp.log
	The special value 'off' disables logging to a file.

	Note that '-L off' and '-si' are mutually exclusive.

 -d	Enabled debug messages.

 -D	Set extreme debugging verbosity using bash 'set -x' mode. Implies -d.

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

EXAMPLES:
	Example 1: Typical usage:

	This script is typically called after SDP update with only the instance
	name or number as an argument, e.g.:

	verify_sdp.sh 1

	Example 2: Skipping some checks.

	verify_sdp.sh 1 -skip crontab

	Example 3: Automation Usage

	If used from automation that is already doing its own logging, use -L off:

	verify_sdp.sh 1 -L off

	Example 4: Include online checks

	This examples relies on the $SDP_INSTANCE variable rather than passing
	the <instance> parameter.

	verify_sdp.sh -online

	Example 5: Thorough Usage

	Run all available tests (-online is implied):

	verify_sdp.sh -extra all

LOGGING:
	This script generates a log file and also displays it to stdout at the
	end of processing.  By default, the log is:
	/p4/N/logs/verify_sdp.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 '-si' (silent) flag is used, the log is generated, but its
	contents are not displayed to stdout at the end of processing.

EXIT CODES:
	An exit code of 0 indicates no errors were encountered attempting to
	perform verifications, and that all checks verified cleanly.

