USAGE for prsync_depots.sh v5.3.0: prsync_depots.sh [-c ] [-p] [-y] [-d|-D] [-si] or prsync_depots.sh [-h|-man] DESCRIPTION: This script is useful for copying depot directories across two p4d servers, e.g. to aid it backing up or migrating data. It is intended to be executed on the target server, and it uses a series of parallel rsync commands to pull from the source server. It requires that SSH keys be setup such that password-less ssh is enabled from the target server into the source server, so that 'ssh' and 'rsync' commands are not prompted for a password. This script uses 2 configuration files, a static configuration file and a 'max procs' configuration file. STATIC CONFIG FILE: The static configuration file defines settings that are loaded at startup, and cannot change once the process starts. The following sample file illustrates settings: The sample static config file is missing: prsync_depots.sample.cfg MAX PROCS CONFIG FILE: The 'max procs' config file is created when this script starts, unless it already exists. The file is: It is a one-line, file, and looks something like this: MAX_RSYNC_PROCS=8 This defines the max rsync processes that can be running, and is a form of throttle control. It can be adjusted up or down by carefully editing the file even while the script is running. Simply change the number on the right side of the '=' in the line to change the value of MAX_RSYNC_PROCS. If increased during processing, more threads will be added quickly (after about 10 seconds). If decreased during processing, it may take a while for in-flight rsyncs to finish before the process count gets down to the desired level. This script will (by design) not distinguish 'rsync' commands launched from this script with any other rsync processing that may be occurring, so other (perhaps manual) rsyncs can keep this script from launching rsync threads, delaying its progress, but also avoiding overloading the machine. In any case, that absolute max processes that can be launched is 2 less than the number of processors (but never less than a max of 4). The number of processors is determined on Linux with: grep -c processor /proc/cpuinfo OPTIONS: -c Specify the path to the config file. The default is: /p4/common/config/prsync_depots..cfg -p Specify '-p' to indicate that only preflight checks should be run, and then the script will exit. This can be useful to view the loaded configuration file. -y Specify '-y' to indicate live processing is to occur. By default, this script operates in NoOp mode, meaning it prints data-affecting commands instead of running them. NoOp mode is effectively a dry-run. This will verify SSH access to the remote server. -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 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'. This is useful when running from cron, as it prevents automatic email from being sent by cron directly, as cron does when a script called from cron generates output. Some preflight checks that occur early in processing, before logging is initiated, may be displayed to the output even if '-si' -is used. -d Set debugging verbosity; enable debug messages. If '-d' is specified, the working directory is not removed even if all processing is successful. -D Set extreme bash 'set -x' debugging verbosity. -D also implies -d. HELP OPTIONS: -h Display short help message -man Display man-style help message EXAMPLES: Example 1: Running preflight only: prsync_depots.sh -c /path/to/prsync_depots.cfg -p Example 2: Dry run specifying a config file: prsync_depots.sh -c /path/to/prsync_depots.cfg Example 3: Kicking off a live run preflight only: prsync_depots.sh -c /path/to/prsync_depots.cfg -y