USAGE for sdp_sync.sh v2.1.15: sdp_sync.sh [-H [,,...]] [-i ] [-s] [-m] [-c] [-r] [-e|-E] [-L ] [-si] [-v] [-n|-N] [-D] or sdp_sync.sh [-h|-man|-V] DESCRIPTION: This script keeps Perforce Server Deployment Package (SDP) scripts in sync on all SDP hosts, as defined by the SDP_SYNC_HOSTS setting in the file. Also, if used with the '-c' flag, verifies that versioned cron files match those on each system. This script is intended to be called by a cron job the master server. It then does ssh calls to the remaining SDP hosts. Each target host is expect to have a P4CONFIG file named /p4/.p4config.SDP that defines Perforce environment settings that point to Perforce workspaces that enable versioning of the SDP on that host. For pure read-only replicas, the P4PORT value in that P4CONFIG file must point to the master server. Forwarding replicas and Edge Servers can point P4PORT to the master server or locally. The worskpaces must be configured for each host. Typically they reference paths in the Perforce server that are common across all SDP servers, e.g. to populate the /p4/common/bin folder. Other paths are host-specific, like the /p4//bin folders that indicate which instances are active on the machine as well as which type of servers are active for each instance (p4d, p4p, p4broker, etc.). This depends on ssh keys being setup such that the Perforce login (as defined by OSUSER in /p4/common/bin/p4_vars) can ssh without a password to all SDP hosts. (To simplify failover, the backup servers should also be able to ssh to each other without a password; security implications should be considered here.) OPTIONS: -H [,,...] Specify a comma-delimited list of hosts to push to. By default, the SDP_SYNC_HOSTS value defined in the config file determines the list of hosts to push to. -i Specify the SDP instance tag (e.g 1 for /p4/1, abc for /p4/abc) for the SDP instance that contains the SDP. The default is to use the $SDP_INSTANCE variable if defined, or else '1'. -s Specify that a 'p4 status' check should be done in directories specified by the SDP_STATUS_DIRS variable defined in . Alternately, a host-specific value for SDP_STATUS_DIRS may be defined in a file named sdp_status_dirs..cfg in the /p4/common/config dir. -m Use with '-s' to specify that the '-m' flag to 'p4 status' should be used for a faster check (without MD5 digest comparison). If '-m' is specified without '-s', the '-s' is implied. -c Specifies that the crontab for the OSUSER (perforce) on each machine should be compared against the the versioned cron file in: /p4/common/etc/cron.d In that directory, the cron files are named crontab.. The cron check is done for all hosts defined in the ALL_SDP_HOSTS setting in . -r Specify this option to remove old sdp_sync.*.log files. If this option is specified, log files named /p4//logs/sdp_sync.*.log (where '' is the SDP instance name) that are older than the number of journal rotations indicated by the KEEPLOGS setting in /p4/common/bin/p4_vars are removed. The old log removal occurs only upon successful completion. -e Send email to MAILTO value defined in /p4/common/bin/p4_vars in event of failure only. -E Send email to MAILTO value defined in /p4/common/bin/p4_vars. -v Set verbosity 1-5 (-v1 = quiet, -v5 = highest). -L Specify the path to a log file, or the special value 'off' to disable logging. By default, all output (stdout and stderr) goes to a log file named sdp_sync..log in . NOTE: This script is self-logging. That is, output displayed on the screen is simultaneously captured in the log file. Do not run this script with redirection operators like '> log' or '2>&1', and do not use 'tee.' -si Operate silently. All output (stdout and stderr) is redirected to the log only; no output appears on the terminal. This cannot be used with '-L off'. -n No-Op. Prints commands instead of running them. -N No-Op. Similar to '-n', but this command does execute the 'ssh' calls to get to the remote host, but then does 'p4 sync -n' rather than' 'p4 sync' on the remote host. -D Set extreme debugging verbosity. HELP OPTIONS: -h Display short help message -man Display man-style help message -V Dispay version info for this script and its libraries. FILES: The SDP environment file /p4/common/bin/p4_vars defines various SDP settings, and is used by several SDP scripts. The host config file defines the SDP_SYNC_HOSTS and other values. EXAMPLES: Recommended crontab usage for SDP Instance 1: /p4/common/bin/sdp_sync.sh -i 1 -si -s -c -r -e < /dev/null > /dev/null 2>&1 The redirect to /dev/null is to avoid any output that would generate a duplicate email from cron. Output is not lost; it is written to a timestampped log file: /logs/sdp_sync..log SEE ALSO: See this related script: /p4/common/bin/global_replica_status.sh