#!/bin/bash #------------------------------------------------------------------------------ # Copyright (c) Perforce Software, Inc., 2007-2015. All rights reserved # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1 Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE # SOFTWARE, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH # DAMAGE. #------------------------------------------------------------------------------ # This script is designed to rebuild an Edge server from a checkpoint off the master. # You have to first copy the checkpoint from the master to the edge server before running this script. # Then you run this script on the Edge server with the instance number and full path and filename # of the master checkpoint as parameters. # # Run example: # ./recover.sh 1 /depotdata/p4_1.ckp.9188.gz if [[ "$1" == "" ]]; then echo You must pass in the instance number as the first parameter to this script. exit 1 fi if [[ "$2" == "" ]]; then echo You must pass in the full path and filename of the checkpoint you copied over from the master server. exit 2 fi INSTANCE=$1 MASTERCKP=$2 rm -f /p4/${INSTANCE}/offline_db/db.* /p4/${INSTANCE}/bin/p4d_${INSTANCE} -r /p4/${INSTANCE}/offline_db/ -K db.have,db.working,db.resolve,db.locks,db.revsh,db.workingx,db.resolvex -jr -z $MASTERCKP /p4/${INSTANCE}/bin/p4d_${INSTANCE}_init stop /p4/${INSTANCE}/bin/p4d_${INSTANCE} -r /p4/${INSTANCE}/root/ -k db.have,db.working,db.resolve,db.locks,db.revsh,db.workingx,db.resolvex,db.view,db.label,db.revsx,db.revux -jd /p4/${INSTANCE}/checkpoints/edgedump /p4/${INSTANCE}/bin/p4d_${INSTANCE} -r /p4/${INSTANCE}/offline_db -jr /p4/${INSTANCE}/checkpoints/edgedump rm -f /p4/${INSTANCE}/root/db.* rm -f /p4/${INSTANCE}/root/state rm -f /p4/${INSTANCE}/root/rdb.lbr rm -f /p4/${INSTANCE}/logs/journal mv /p4/${INSTANCE}/offline_db/db.* /p4/${INSTANCE}/root/ /p4/${INSTANCE}/bin/p4d_${INSTANCE}_init start /p4/${INSTANCE}/bin/p4d_${INSTANCE} -r /p4/${INSTANCE}/offline_db/ -K db.have,db.working,db.resolve,db.locks,db.revsh,db.workingx,db.resolvex -jr -z $MASTERCKP /p4/${INSTANCE}/bin/p4d_${INSTANCE} -r /p4/${INSTANCE}/offline_db -jr /p4/${INSTANCE}/checkpoints/edgedump /p4/${INSTANCE}/bin/p4d_${INSTANCE} -r /p4/${INSTANCE}/offline_db -jd -z /p4/${INSTANCE}/checkpoints/rebuilt_edge_dump.gz echo Rebuilt checkpoint is: /p4/${INSTANCE}/checkpoints/rebuilt_edge_dump.gz echo If you run this script the night before a weekly_backup.sh is going to run, echo you need to delete the highest numbered checkpoint in /p4/${INSTANCE}/checkpoints echo and rename /p4/${INSTANCE}/checkpoints/rebuilt_edge_dump.gz to replace that file.
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#15 | 28240 | C. Thomas Tyler |
Released SDP 2021.1.28238 (2021/11/12). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#14 | 27331 | C. Thomas Tyler |
Released SDP 2020.1.27325 (2021/01/29). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#13 | 26496 | C. Thomas Tyler |
Released SDP 2019.3.26494 (2020/04/23). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#12 | 25951 | C. Thomas Tyler |
Released SDP 2019.2.25949 (2019/08/12). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#11 | 25940 | C. Thomas Tyler |
Released SDP 2019.2.25938 (2019/08/05). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#10 | 25933 | C. Thomas Tyler |
Released SDP 2019.2.25923 (2019/08/05). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#9 | 23331 | C. Thomas Tyler |
Released SDP 2017.4.23329 (2017/12/05). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#8 | 23006 | C. Thomas Tyler |
Released SDP 2017.3.23003 (2017/10/19). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#7 | 21338 | C. Thomas Tyler |
Released SDP 2016.2.21328 (2016/12/16). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#6 | 19414 | C. Thomas Tyler | Released SDP/MultiArch/2016.1/19410 (2016/05/17). | ||
#5 | 17315 | C. Thomas Tyler |
Released SDP/MultiArch/2016.1/17297 (2016/02/03). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#4 | 16845 | C. Thomas Tyler | Fixed typo in script name in a comment; no functional change. | ||
#3 | 15856 | C. Thomas Tyler |
Replaced the big license comment block with a shortened form referencing the LICENSE file included with the SDP package, and also by the URL for the license file in The Workshop. |
||
#2 | 15777 | C. Thomas Tyler |
No functional changes. Style Policing only on bash scripts only. Normalized indentation and line breaks, removed offending tabs, and general whitespace usage. |
||
#1 | 15716 | Russell C. Jackson (Rusty) | Script for rebuilding an Edge server. |