#!/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 #------------------------------------------------------------------------------ # This script expects the most recent valid checkpoint to be available in # $CHECKPOINTS in order for this script to work. # # This script is using the following external variables: # # SDP_INSTANCE - The instance of Perforce that is being backed up. If not # set in environment, pass in as argument to script. # # P4HOME - Server's home directory. # P4BIN - Command line client name for the instance being backed up. # P4DBIN - Server executable name for the instance being backed up. # P4ROOT - Server's root directory. p4/root, p4_N/root # P4PORT - TCP/IP port for the server instance being backed up. # P4JOURNAL - Location of the Journal for the server instance being backed up. # # 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/checkpoint.log ######### Start of Script ########## check_vars set_vars check_uid check_dirs ckp_running /p4/common/bin/p4login get_journalnum rotate_last_run_logs log "Start $P4SERVER journal rotation" get_offline_journal_num truncate_journal replay_journals_to_offline_db remove_old_checkpoints_and_journals if [[ -d ${P4HOME}/journals.rep ]]; then cd ${P4HOME}/journals.rep rm $(ls -t | awk 'NR>1') > /dev/null 2>&1 fi remove_old_logs log "End $P4SERVER journal rotation" mail_log_file "$HOSTNAME $P4SERVER journal rotation" ckp_complete
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#9 | 26477 | C. Thomas Tyler |
Patch to rotate_journal.sh. Added coverage for rotate_journal.sh to test suite. |
||
#8 | 26456 | C. Thomas Tyler |
Patch to fix issue with refresh_P4ROOT_from_offline_db.sh behavior on replicas. Adjusted behavior for other scripts to ensure proper behaivor when run on replicas vs. edge servers vs. the master server. Approving patch for testing. |
||
#7 | 26081 | ashaikh |
Add support for opting out of information email messages Currently, we're trying to filter our email to only contain actionable messages. By default, the SDP scripts will always send an email if it's configured when a job has completed. I'd like to add a parameter to suppress informational messages and only get notified if there is an error. I kept the default behavior of always sending an email. |
||
#6 | 23778 | C. Thomas Tyler | Removed obsolete code from recreate_db_checkpoint.sh and rotate_journal.sh. | ||
#5 | 20940 | Russell C. Jackson (Rusty) |
Drop JOURNALNUM from the rotated log names because it forces you to wait to rotate the prior logs until you get the journal number and creates a problem where the error that you couldn't get the journal number ends up at the end of the previous days log file, and that is what gets email out. That causes confusion for the person trying to see what the error is. Moved all rotate_last_run_logs up to the point right after we set the environment. |
||
#4 | 20708 | C. Thomas Tyler |
Per discussion: s/checkpoints.rep/journals.rep/g This directory name changed, used in the journalPrefix configurable, is intended to clarify that the should be targeted to for a FAST volume for use with journalcopy, rather than the LARGE volume as would be implied when using a directory with "checkpoints" in the name. |
||
#3 | 20425 | C. Thomas Tyler |
chmod +x rotate_journal.sh. Done with: p4 edit -t +x rotate_journal.sh. This is just a filetype tweak; there are no content changes. #review-20426 |
||
#2 | 19768 | UnstoppableDrew |
@tom_tyler @russell_jackson Bug fix for running p4master_run as root, and some comment header cleanup. Job 000543 p4master_run: Preserve original arguments list and use this when exec'ing as $OSUSER. backup_functions.sh: Add text about sourcing p4_vars yourself instead of using p4master_run. update_limites.py: Run p4login directly without p4master_run since p4login calls p4_vars now. everything else: Remove comment block about needing to run with p4master_run. Reword comment about SDP_INSTANCE since it is not always an integer value. |
||
#1 | 18859 | Russell C. Jackson (Rusty) |
Created script to rotate the journal and replay it to the offline database. Updated the crontab to run the new script before the weekly. Updated the edge crontab to account for the time adjustment in the master crontab. |