backup_functions.sh #27

  • //
  • guest/
  • perforce_software/
  • sdp/
  • main/
  • Server/
  • Unix/
  • p4/
  • common/
  • bin/
  • backup_functions.sh
  • View
  • Commits
  • Open Download .zip Download (15 KB)
#!/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
#------------------------------------------------------------------------------

set -u

# Common functions used in all backup scripts.

check_vars () {
   if [[ -z "$SDP_INSTANCE" || -z "$P4HOME" || -z "$P4PORT" || -z "$P4ROOT" || -z "$P4JOURNAL" || -z "$P4BIN" || -z "$P4DBIN" || -z "$P4TICKETS" || -z "$KEEPCKPS" || -z "$KEEPLOGS" || -z "$CHECKPOINTS" || -z "$LOGS" || -z "$OSUSER" ]]; then
      echo "Use p4master_run when calling this script."
      echo "Required external variable not set. Abort!"
      exit 1
   fi
}

set_vars () {
   RC=/etc/init.d/p4d_${SDP_INSTANCE}_init
   [[ -f "$RC" ]] || RC=/p4/$SDP_INSTANCE/bin/p4d_${SDP_INSTANCE}_init
   LOGFILE=$LOGS/checkpoint.log
   OFFLINE_DB=${P4HOME}/offline_db
   SAVEDIR=${P4ROOT}/save
   EDGESERVER=0
   $P4BIN -u $P4USER -p $P4PORT login < /p4/common/bin/adminpass > /dev/null
   $P4BIN -u $P4USER -p $P4PORT server -o $SERVERID | grep ^Services | grep "edge-server" > /dev/null
   if [[ `echo $?` -eq 0 ]]; then
      EDGESERVER=1
   fi
}

# check if user is running as required OS user
check_uid () {
   user=`id -un`
   if [[ ${user} != ${OSUSER} ]]; then
      die "Must be run by user: ${OSUSER}. Abort!"
   fi
}

log () {
   echo -n `date`    2>&1 >> "$LOGFILE"
   echo " $0: $@" 2>&1 >> "$LOGFILE"
}

# Decide depending on our mail utility, how to specify sender (if we need to)
get_mail_sender_opt () {
   local mail_sender_opt=""
   if [[ ! -z "$MAILFROM" ]]; then
      # Default for CentOS/RHEL, but allow GNU Mailutils alternative flag instead
      mail_sender_opt="-S from=$MAILFROM"
      local mail_ver=`$SDPMAIL -V`
      [[ "$mail_ver" =~ "GNU Mailutils" ]] && mail_sender_opt="-aFrom:$MAILFROM"
   fi
   echo "$mail_sender_opt"
}

mail_log_file () {
   local subject=$1
   local mail_sender_opt=$(get_mail_sender_opt)
   $SDPMAIL -s "$subject" $mail_sender_opt $MAILTO < "$LOGFILE"
}

die () { # send mail and exit
   # mail the error (with more helpful subject line than cron)
   log "ERROR!!! - $HOSTNAME $P4SERVER $0: $@"
   mail_log_file "ERROR!!! - $HOSTNAME $P4SERVER $0: $@"

   # if running from terminal, also send to stderr
   tty >/dev/null
   if [[ $? -eq 0 ]]; then
      echo "$@" >&2
   fi
   exit 1
}

checkdir () {
   local dir=$1
   [[ -w $dir ]] && return
   if [[ "$check" = 1 ]]; then   # --check, run interactively.  just tell user.
      echo "$0: $dir is not writable!"
      dirs_ok=false
   else
      die "$dir is not writable. Abort!"
   fi
}

check_dirs () {
   # Check that key dirs are writable
   dirs_ok=true
   for dir in $OFFLINE_DB $CHECKPOINTS $LOGS; do
      checkdir $dir    # aborts on failure.
   done
}

check_disk_space () {
   # Add the results of df -h or df -m to the log file.
   log "Checking disk space..."
   $P4BIN diskspace >> "$LOGFILE" 2>&1
}

check_journalnum () {
   re='^[0-9]+$'
   if ! [[ $JOURNALNUM =~ $re ]] ; then
      die "Journal number must be numeric."
   fi
}

get_journalnum () {
   # get the current journal and checkpoint serial numbers.
   JOURNALNUM=`$P4BIN -u $P4USER -p $P4PORT counter journal 2>> $LOGFILE` || \
   die "Cannot get the checkpoint number. Abort!"
   # If we are on an edge server, the journal has already rotated, so we have to decrement the value
   # so that we replay the correct journal file and create the correct checkpoint number on the
   # edge server.
   check_journalnum
   if [[ $EDGESERVER -eq 1 ]]; then
      JOURNALNUM=$(($JOURNALNUM - 1))
   fi
   CHECKPOINTNUM=$(($JOURNALNUM + 1))
}

get_offline_journal_num () {
   # Get the journal number of the offline database
   if [[ ! -f $OFFLINE_DB/offline_db_usable.txt ]]; then
      die "Offline database not in a usable state. Check the backup process."
   fi
   if [[ ! -f $OFFLINE_DB/db.counters ]]; then
      die "Offline database not found. Consider creating it with live_checkpoint.sh. Be aware that it locks the live system and can take a long time! Abort!"
      log "Offline database not found."
   fi
   OFFLINEJNLNUM=`$P4DBIN -r $OFFLINE_DB -jd - db.counters | grep '@journal@' | cut -d "@" -f 8 2>> $LOGFILE` || \
   die "Cannot get the offline journal number. Abort!"
   check_journalnum
   log "Offline journal number is: $OFFLINEJNLNUM"
   if [[ $OFFLINEJNLNUM -gt $JOURNALNUM ]]; then
      die "$JOURNALNUM already replayed into the offline database."
   fi 
}

replay_journals_to_offline_db () {
   log "Replay any unreplayed journals to the offline database"
   for (( j=$OFFLINEJNLNUM; $j <= (($JOURNALNUM-1)); j++ )); do
      log "Replay journal ${P4SERVER}.jnl.${OFFLINEJNLNUM} to offline db."
      # curly braces are necessary to capture the output of 'time'
      { time $P4DBIN -r $OFFLINE_DB -jr -f ${CHECKPOINTS}/${P4SERVER}.jnl.${j}; } \
         >> "$LOGFILE" 2>&1 || { die "Offline journal replay failed. Abort!"; }
   done
}
 
remove_old_checkpoints_and_journals () {
   if [[ $KEEPCKPS -eq 0 ]]; then
      log "Skipping cleanup of old checkpoints because KEEPCKPS is set to 0."
   elif [[ $(($JOURNALNUM-$KEEPCKPS)) -gt 7 ]]; then
      log "Deleting obsolete checkpoints and journals. Keeping latest $KEEPCKPS  per KEEPCKPS setting in p4_vars."

      STARTNUM=$(($JOURNALNUM-$KEEPCKPS-100))
      if [[ $STARTNUM -lt 0 ]]; then
         STARTNUM=0
      fi

      # Remove selected checkpoint and journal files based on
      # journal counter, regardless of whether compressed or not.
      for (( j=$STARTNUM; $j <= (($JOURNALNUM-$KEEPCKPS)); j++ )); do
         I_CKPFILE=${CHECKPOINTS}/${P4SERVER}.ckp.$j
         I_JNLFILE=${CHECKPOINTS}/${P4SERVER}.jnl.$j

         if [[ -f "$I_CKPFILE" ]]; then
            log "rm -f $I_CKPFILE"
            rm -f "$I_CKPFILE"
         fi
            
         if [[ -f "${I_CKPFILE}.md5" ]]; then
            log "rm -f ${I_CKPFILE}.md5"
            rm -f "${I_CKPFILE}.md5"
         fi

         if [[ -f "$I_JNLFILE" ]]; then
            log "rm -f $I_JNLFILE"
            rm -f "$I_JNLFILE"
         fi

         I_CKPFILE=${CHECKPOINTS}/${P4SERVER}.ckp.$j.gz
         I_JNLFILE=${CHECKPOINTS}/${P4SERVER}.jnl.$j.gz

         if [[ -f "$I_CKPFILE" ]]; then
            log "rm -f $I_CKPFILE"
            rm -f "$I_CKPFILE"
         fi

         if [[ -f "${I_CKPFILE}.md5" ]]; then
            log "rm -f ${I_CKPFILE}.md5"
            rm -f "${I_CKPFILE}.md5"
         fi

         if [[ -f "$I_JNLFILE" ]]; then
            log "rm -f $I_JNLFILE"
            rm -f "$I_JNLFILE"
         fi
      done
   else
      log "No old checkpoints and journals need to be deleted."
   fi
}

stop_p4d () {
   log "Shutting down the p4 server"
   $RC stop >> "$LOGFILE" 2>&1
   COUNTER=`ps -ef | grep -i $P4DBIN | grep -v grep | wc -l`
   while [[ $COUNTER != "0" ]]; do
      sleep 5
      COUNTER=`ps -ef | grep -i $P4DBIN | grep -v grep | wc -l`
   done
   log "p4 stop finished -- p4 should be down now."
}

start_p4d () {
   log "Starting the p4 server"
   $RC start >> "$LOGFILE" 2>&1
   sleep 3 # Give it a few seconds to start up
   # Confirm that it started - success below means it did
   if $P4BIN -u $P4USER -p $P4PORT info >/dev/null 2>&1 ; then
      log "Server restarted successfully - p4 should be back up now."
   else
      log "Error: Server does not appear to have started."
   fi
}

truncate_journal () {
   [[ -f ${CHECKPOINTS}/${P4SERVER}.ckp.${CHECKPOINTNUM}.gz ]] && die "Checkpoint ${CHECKPOINTS}/${P4SERVER}.ckp.${CHECKPOINTNUM}.gz already exists, check the backup process."
   if [[ $EDGESERVER -eq 0 ]]; then
      [[ -f ${CHECKPOINTS}/${P4SERVER}.jnl.${JOURNALNUM} ]] && die "Journal ${CHECKPOINTS}/${P4SERVER}.jnl.${JOURNALNUM} already exists, check the backup process."
      log "Truncating journal..."
      # 'p4d -jj' does a copy-then-delete, instead of a simple mv.
      # during 'p4d -jj' the perforce server will hang the responses to clients.
      # curly braces are necessary to capture the output of 'time'
      { time $P4DBIN -r $P4ROOT -J $P4JOURNAL -jj ${CHECKPOINTS}/${P4SERVER}; } \
         >> "$LOGFILE" 2>&1 || \
            { start_p4d; die "Journal rotation failed. Abort!"; }
   fi
}

replay_journal_to_offline_db () {
   log "Replay journal to offline db."
   # curly braces are necessary to capture the output of 'time'
   { time $P4DBIN -r $OFFLINE_DB -jr -f ${CHECKPOINTS}/${P4SERVER}.jnl.${JOURNALNUM}; } \
      >> "$LOGFILE" 2>&1 || \
         { die "Journal replay failed. Abort!"; }
}

replay_active_journal_to_offline_db () {
   log "Replay active journal to offline db."
   # curly braces are necessary to capture the output of 'time'
   { time $P4DBIN -r $OFFLINE_DB -jr -f ${P4JOURNAL}; } \
      >> "$LOGFILE" 2>&1 || \
         { die "Active Journal replay failed. Abort!"; }
}

dump_checkpoint () {
   log "Dump out new checkpoint from db files in $ROOTDIR."
   # curly braces are necessary to capture the output of 'time'
   { time $P4DBIN -r $ROOTDIR -jd -z ${CHECKPOINTS}/${P4SERVER}.ckp.${CHECKPOINTNUM}.gz; } \
      >> "$LOGFILE" 2>&1 || { die "New checkpoint dump failed!"; }
}

recreate_offline_db_files () {
   log "Recreate offline db files for quick recovery process."
   rm -f ${OFFLINE_DB}/offline_db_usable.txt
   rm -f ${OFFLINE_DB}/db.* >> "$LOGFILE"
   # curly braces are necessary to capture the output of 'time'
   { time $P4DBIN -r $OFFLINE_DB -jr -z ${CHECKPOINTS}/${P4SERVER}.ckp.${CHECKPOINTNUM}.gz; } \
      >> "$LOGFILE" 2>&1 || { die "Restore of checkpoint to $OFFLINE_DB failed!"; }
   echo "Offline db file restored successfully." > ${OFFLINE_DB}/offline_db_usable.txt
}

recreate_weekly_offline_db_files () {
   log "Recreate offline db files for quick recovery process."
   rm -f ${OFFLINE_DB}/offline_db_usable.txt
   rm -f ${OFFLINE_DB}/db.* >> "$LOGFILE"
   LASTCKP=`ls -t ${CHECKPOINTS}/${P4SERVER}.ckp.*.gz | head -1`
   # curly braces are necessary to capture the output of 'time'
   { time $P4DBIN -r $OFFLINE_DB -jr -z ${LASTCKP}; } \
      >> "$LOGFILE" 2>&1 || { die "Restore of checkpoint to $OFFLINE_DB failed!"; }
   echo "Offline db file restored successfully." > ${OFFLINE_DB}/offline_db_usable.txt
}


# At the start of each run for live_checkpoint.sh, daily_backup.sh, and
# weekly_backup.sh, before *any* logging activity occurs, rotate the logs
# from the most recent prior run, always named "checkpoint.log" or "log".
rotate_last_run_logs () {
   # Rotate prior checkpoint.log
   [[ -f "$LOGFILE" ]] && mv -f "$LOGFILE" "$LOGFILE.$JOURNALNUM"

   # Rotate prior server log.
   if [[ -f "$LOGS/log" ]]; then
      mv -f "$LOGS/log" "$LOGS/log.$JOURNALNUM" >> $LOGFILE 2>&1
      cd "$LOGS"
      rm -f "log.$JOURNALNUM.gz"
      gzip "log.$JOURNALNUM" >> $LOGFILE 2>&1
      cd - > /dev/null
   fi

   # Rotate prior broker log.
   if [[ -f "$LOGS/p4broker.log" ]]; then
      mv -f "$LOGS/p4broker.log" "$LOGS/p4broker.log.$JOURNALNUM" >> $LOGFILE 2>&1
      cd "$LOGS"
      rm -f "p4broker.log.$JOURNALNUM.gz"
      gzip "p4broker.log.$JOURNALNUM" >> $LOGFILE 2>&1
      cd - > /dev/null
   fi

   # Rotate prior audit log.
   if [[ -f "$LOGS/audit.log" ]]; then
      mv -f "$LOGS/audit.log" "$LOGS/audit.log.$JOURNALNUM" >> $LOGFILE 2>&1
      cd "$LOGS"
      rm -f "audit.log.$JOURNALNUM.gz"
      gzip "audit.log.$JOURNALNUM" >> $LOGFILE 2>&1
      cd - > /dev/null
   fi

   # Rotate prior sync_replica log.
   if [[ -f "$LOGS/sync_replica.log" ]]; then
      mv -f "$LOGS/sync_replica.log" "$LOGS/sync_replica.log.$JOURNALNUM" >> $LOGFILE 2>&1
      cd "$LOGS"
      rm -f "sync_replica.log.$JOURNALNUM.gz"
      gzip "sync_replica.log.$JOURNALNUM" >> $LOGFILE 2>&1
      cd - > /dev/null
   fi
}

remove_old_logs () {
   # Remove old Checkpoint Logs
   # Use KEEPCKPS rather than KEEPLOGS, so we keep the same number
   # of checkpoint logs as we keep checkpoints.
   # Avoid automatically removing #'s 1-7 in any case.
   STARTNUM=$(($JOURNALNUM-$KEEPLOGS-100))
   if [[ $STARTNUM -lt 0 ]]; then
      STARTNUM=0
   fi

   if [[ $KEEPCKPS -eq 0 ]]; then
      log "Skipping cleanup of old checkpoint logs because KEEPCKPS is set to 0."
   elif [[ $(($JOURNALNUM-$KEEPCKPS)) -gt 7 ]]; then
      log "Deleting old checkpoint logs.  Keeping latest $KEEPCKPS, per KEEPCKPS setting in p4_vars."
      for (( j=$STARTNUM; $j <= (($JOURNALNUM-$KEEPCKPS)); j++ )); do
         I_LOGFILE="$LOGS/checkpoint.log.$j"
         if [[ -f "$I_LOGFILE" ]]; then
            log "rm -f $I_LOGFILE"
            rm -f "$I_LOGFILE"
         fi
      done
   else
      log "No old checkpoint logs need to be deleted."
   fi

   if [[ $KEEPLOGS -eq 0 ]]; then
      log "Skipping cleanup of old server logs because KEEPLOGS is set to 0."
   elif [[ $(($JOURNALNUM-$KEEPLOGS)) -gt 7 ]]; then
      log "Deleting old server logs.  Keeping latest $KEEPLOGS, per KEEPLOGS setting in p4_vars."

      for (( j=$STARTNUM; $j <= (($JOURNALNUM-$KEEPLOGS)); j++ )); do
         I_LOGFILE="$LOGS/log.$j"
         if [[ -f "$I_LOGFILE" ]]; then
            log "rm -f $I_LOGFILE"
            rm -f "$I_LOGFILE"
         fi
         I_LOGFILE="$LOGS/log.$j.gz"
         if [[ -f "$I_LOGFILE" ]]; then
            log "rm -f $I_LOGFILE"
            rm -f "$I_LOGFILE"
         fi
      done

      for (( j=$STARTNUM; $j <= (($JOURNALNUM-$KEEPLOGS)); j++ )); do
         I_LOGFILE="$LOGS/p4broker.log.$j"
         if [[ -f "$I_LOGFILE" ]]; then
            log "rm -f $I_LOGFILE"
            rm -f "$I_LOGFILE"
         fi
         I_LOGFILE="$LOGS/p4broker.log.$j.gz"
         if [[ -f "$I_LOGFILE" ]]; then
            log "rm -f $I_LOGFILE"
            rm -f "$I_LOGFILE"
         fi
      done

      for (( j=$STARTNUM; $j <= (($JOURNALNUM-$KEEPLOGS)); j++ )); do
         I_LOGFILE="$LOGS/audit.log.$j"
         if [[ -f "$I_LOGFILE" ]]; then
            log "rm -f $I_LOGFILE"
            rm -f "$I_LOGFILE"
         fi
         I_LOGFILE="$LOGS/audit.log.$j.gz"
         if [[ -f "$I_LOGFILE" ]]; then
            log "rm -f $I_LOGFILE"
            rm -f "$I_LOGFILE"
         fi
      done

      for (( j=$STARTNUM; $j <= (($JOURNALNUM-$KEEPLOGS)); j++ )); do
         I_LOGFILE="$LOGS/sync_replica.log.$j"
         if [[ -f "$I_LOGFILE" ]]; then
            log "rm -f $I_LOGFILE"
            rm -f "$I_LOGFILE"
         fi
         I_LOGFILE="$LOGS/sync_replica.log.$j.gz"
         if [[ -f "$I_LOGFILE" ]]; then
            log "rm -f $I_LOGFILE"
            rm -f "$I_LOGFILE"
         fi
      done
   else
      log "No old server logs need to be deleted."
   fi
}

set_counter() {
   $P4BIN -u $P4USER -p $P4PORT login < /p4/common/bin/adminpass > /dev/null
   $P4BIN -u $P4USER -p $P4PORT counter lastSDPCheckpoint "$(date +'%s (%y/%m/%d %H:%M:%S %z %Z)')" > /dev/null
}

ckp_running() {
   if [[ -f ${CHECKPOINTS}/ckp_running.txt ]]; then
      die "Last checkpoint not complete. Check the backup process."
   fi
   echo "Checkpoint running." > ${CHECKPOINTS}/ckp_running.txt
}

ckp_complete() {
   rm -f ${CHECKPOINTS}/ckp_running.txt
}
# Change User Description Committed
#80 31566 C. Thomas Tyler Released SDP 2024.2.31564 (2025/05/14).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#79 31204 Will Kreitzmann Released SDP 2024.2.31193 (2025/01/17).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#78 31077 C. Thomas Tyler Released SDP 2024.2.31075 (2024/12/20).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#77 30915 C. Thomas Tyler Released SDP 2024.1.30913 (2024/11/20).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#76 30388 C. Thomas Tyler Released SDP 2024.1.30385 (2024/06/11).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#75 30297 C. Thomas Tyler Released SDP 2023.2.30295 (2024/05/08).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#74 30043 C. Thomas Tyler Released SDP 2023.2.30041 (2023/12/22).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#73 29954 C. Thomas Tyler Released SDP 2023.1.29949 (2023/12/01).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#72 29891 C. Thomas Tyler Released SDP 2023.1.29699 (2023/07/11).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#71 29612 C. Thomas Tyler Released SDP 2023.1.29610 (2023/05/25).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#70 29443 C. Thomas Tyler Released SDP 2022.2.29441 (2023/02/27).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#69 29401 C. Thomas Tyler Released SDP 2022.2.29399 (2023/02/06).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#68 29252 C. Thomas Tyler Released SDP 2022.2.29250 (2022/12/08).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#67 29143 C. Thomas Tyler Released SDP 2022.1.29141 (2022/10/29).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#66 28858 C. Thomas Tyler Released SDP 2022.1.28855 (2022/05/27).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#65 28651 C. Thomas Tyler Released SDP 2021.2.28649 (2022/03/03).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#64 28412 C. Thomas Tyler Released SDP 2021.2.28410 (2021/11/24).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#63 28240 C. Thomas Tyler Released SDP 2021.1.28238 (2021/11/12).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#62 27761 C. Thomas Tyler Released SDP 2020.1.27759 (2021/05/07).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#61 27463 C. Thomas Tyler Released SDP 2020.1.27457 (2021/02/17).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#60 27331 C. Thomas Tyler Released SDP 2020.1.27325 (2021/01/29).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#59 26496 C. Thomas Tyler Released SDP 2019.3.26494 (2020/04/23).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#58 26480 C. Thomas Tyler Released SDP 2019.3.26478 (2020/04/12).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#57 26475 C. Thomas Tyler Released SDP 2019.3.26472 (2020/04/10).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#56 26470 C. Thomas Tyler Released SDP 2019.3.26468 (2020/04/10).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#55 26411 C. Thomas Tyler Released SDP 2019.3.26407 (2020/03/28).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#54 26403 C. Thomas Tyler Released SDP 2019.3.26400 (2020/03/28).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#53 26246 C. Thomas Tyler Released SDP 2019.3.26239 (2020/01/08).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#52 26161 C. Thomas Tyler Released SDP 2019.3.26159 (2019/11/06).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#51 25596 C. Thomas Tyler Released SDP 2019.2.25594 (2019/05/02).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#50 25380 C. Thomas Tyler Released SDP 2019.1.25374 (2019/03/21).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#49 25279 C. Thomas Tyler Released SDP 2019.1.25276 (2019/03/06).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#48 25245 C. Thomas Tyler Released SDP 2019.1.25238 (2019/03/02).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#47 23331 C. Thomas Tyler Released SDP 2017.4.23329 (2017/12/05).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#46 23044 C. Thomas Tyler Released SDP 2017.3.23041 (2017/10/24).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#45 23006 C. Thomas Tyler Released SDP 2017.3.23003 (2017/10/19).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#44 22685 Russell C. Jackson (Rusty) Update main with current changes from dev.
#43 22185 C. Thomas Tyler Released SDP 2017.2.22177 (2017/05/17).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#42 21723 C. Thomas Tyler Released SDP 2017.1.21720 (2017/02/17).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#41 21338 C. Thomas Tyler Released SDP 2016.2.21328 (2016/12/16).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#40 21193 Russell C. Jackson (Rusty) Update main from dev.
#39 20974 C. Thomas Tyler Released SDP 2016.2.20972 (2016/11/01).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#38 20858 C. Thomas Tyler Released SDP 2016.2.20856 (2016/10/04).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#37 20767 C. Thomas Tyler Released SDP 2016.2.20755 (2016/09/29).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#36 20353 C. Thomas Tyler Released SDP 2016.1.20348.
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev',
with selective removal of changes related to work-in-progress
changes.
#35 19898 C. Thomas Tyler Released SDP/MultiArch/2016.1/19888 (2016/07/07).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#34 19835 C. Thomas Tyler Released Rev.
SDP/MultiArch/2016.1/19768 (2016/06/24).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#33 19694 C. Thomas Tyler Released SDP/MultiArch/2016.1/19661 (2016/06/08).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#32 19414 C. Thomas Tyler Released SDP/MultiArch/2016.1/19410 (2016/05/17).
#31 18961 C. Thomas Tyler Released: SDP/MultiArch/2016.1/18958 (2016/04/08).
#30 18619 Russell C. Jackson (Rusty) Updating main with current changes.
#29 18530 Russell C. Jackson (Rusty) Update main from dev.
#28 16155 Russell C. Jackson (Rusty) Removed check code that probably hasn't ever worked.
 Deleted mirror_ldap* since that functionality is built into the server now.
#27 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.
#26 15784 Russell C. Jackson (Rusty) Added missing bracket.
#25 15780 C. Thomas Tyler Per Robert:  Style police causing problems :)
Fixed!
#24 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.
#23 15609 C. Thomas Tyler Pushing SDP 2015.1.15607 (2015/09/02).
#22 15197 Russell C. Jackson (Rusty) Corrected versions from testing.
#21 15193 Russell C. Jackson (Rusty) Added semaphore file to indicate state of the offline database and added check into
 the backup process to fail if the state of the offline db is not good.
#20 15190 Russell C. Jackson (Rusty) Added a semaphore file to prevent the checkpoint process from running if another one
 hasn't finished.

 Added a check to make sure the journal number is numeric.
#19 13928 dsp Set lastSDPCounter after a successfull SDP checkpoint

       p4 admin checkpoint sets lastCheckpointAction, which is useful for monitoring, in particular
       when checkpoint age should be observed from the outside through p4. However the SDP is using
       p4d directly to create checkpoints and will not set checkpoints. In order to distinguish human
       actions from the SDP cronjobs, set a new counter lastSDPCounter in a similar format.
#18 13908 C. Thomas Tyler Pushing SDP 2015.1.13906.
#17 12171 Russell C. Jackson (Rusty) Merge in changes to remove the need for p4master_run.
#16 11950 Russell C. Jackson (Rusty) Made die function record ERROR!!!
$HOSTNAME and $P4SERVER in subject.

 Cleaned up message passed to die command and corrected a typo.
#15 11929 Russell C. Jackson (Rusty) Updated die function to just pass parameter to mail_log_file instead of echo.
#14 11919 Russell C. Jackson (Rusty) Added a SERVERID variable to p4_vars and updated backup_functions to use it.

 Changed the location and the names of the config files so that they could
 live in /p4/common/config (You're welcome Tom). The files names are:

 p4_$INSTANCE.vars
 p4_$INSTANCE.p4review.cfg

 p4_$INSTANCE.vars will now set P4REPLICA to FALSE if SERVERID matches
 MASTERNAME, otherwise it is TRUE.

 This change means that a user must change server.id now in order to change
 the role of the server rather than changing the instance vars file. This
 makes more sense to a user that is reading the admin guide about server.id
 rather than overwriting the file based on a setting that isn't in the admin guide.

 Change mkdirs to reflect all of the above changes.
#13 11908 adrian_waters Use set -u to trap unbounded variables
#12 11886 Russell C. Jackson (Rusty) Changed $prog to $0 so that we don't have to set prog in the calling functions.
#11 11766 Robert Cowham Missed a reference to $MAIL in @11758
Tweaked run_tests.sh to output more error messages on failure. Though
this still doesn't show output of individual failed commands.
#10 11758 Russell C. Jackson (Rusty) Change MAIL variable to SDPMAIL to avoid conflicts with customer variables.

 Changed sdp_sync.sh to use get_mail_opts from backup_functions to avoid
 duplicate functions.
#9 11730 Russell C. Jackson (Rusty) Moved P4SERVER variable to p4_vars so that all scripts can use it properly.
 replica_status.sh referenced it, but it wasn't working since it was only in
 backup_functions.sh
#8 11710 Russell C. Jackson (Rusty) Changed die function to call new email function.

Added su to OSUSER functionality to p4master_run to avoid problems with
 people running scripts manually as root by mistake.
#7 11707 Robert Cowham Refactored sending of mail to a common function.
Make the setting of "MAILFROM" work for Ubuntu (GNU Mailutils) as well as CentOS
#6 11570 Russell C. Jackson (Rusty) Brought in changes from Mark Foundry to add -S $MAILFROM to mail commands.

 Changed sync_replica.sh and weekly_sync_replica.sh to use $LOGFILE for consistency.

 Added mail command to both files as well.
#5 11540 Russell C. Jackson (Rusty) Converted to unix format.
#4 11534 Russell C. Jackson (Rusty) Added -f to -jr to cover offline obliterates where the entries are already removed from the offline database.
#3 11524 Russell C. Jackson (Rusty) Released updated version of the SDP from Dev.
#2 11130 Robert Cowham Check for the existence of offline database and log error message if not found.
#1 10148 C. Thomas Tyler Promoted the Perforce Server Deployment Package to The Workshop.