template.crontab #26

  • //
  • guest/
  • russell_jackson/
  • sdp/
  • Server/
  • Unix/
  • p4/
  • common/
  • etc/
  • cron.d/
  • template.crontab
  • View
  • Commits
  • Open Download .zip Download (5 KB)
MAILTO=REPL_MAILTO
MAILFROM=REPL_MAILFROM
PATH=/p4/common/bin:/p4/REPL_INSTANCE/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:
SHELL=/bin/bash

# Times are all preset to times that make sense based on UTC time with most users in PST.

# common tasks

# Commented out since this is only used when the crontab is checked in and updated from Perforce.
# */60 * * * * [ -e /p4/p4.crontab ] && crontab /p4/p4.crontab > /dev/null 2>&1

INSTANCE=REPL_INSTANCE
# Master Verify - Uncomment this line if you do not have any replica servers.
# 5 4 * * 6 [ -e /p4/common/bin ] && /p4/common/bin/run_if_master.sh ${INSTANCE} /p4/common/bin/p4verify.sh ${INSTANCE}

# Run the weekly maintenance script to clean up old users, labels, workspaces and changelists. Be sure to set up the maintenance.cfg file.
0 16 * * * /p4/common/bin/run_if_master.sh ${INSTANCE} /p4/sdp/Maintenance/maintenance ${INSTANCE}
0 16 * * * /p4/common/bin/run_if_edge.sh ${INSTANCE} /p4/sdp/Maintenance/edge_maintenance ${INSTANCE}

# Run p4 unlock -x on edge servers every six hours to remove exclusive locks that shouldn't be there.
0 */6 * * * [ -e /p4/common/bin ] && /p4/common/bin/run_if_master.sh ${INSTANCE} p4 unlock -x > /dev/null 2>&1
0 */6 * * * [ -e /p4/common/bin ] && /p4/common/bin/run_if_edge.sh ${INSTANCE} p4 unlock -x > /dev/null 2>&1

# Update the limits group to make sure all users are listed in it.
*/60 * * * * [ -e /p4/common/bin ] && /p4/common/bin/run_if_master.sh ${INSTANCE} /p4/common/bin/update_limits.py ${INSTANCE}

# Checkpoints
# Run recreate_db_checkpoint.sh on the first Saturday afternoon in Jan. and July.
# 5 5 * * 6 [ $(date +\%d) -le 07 ] && /p4/common/bin/run_if_master.sh ${INSTANCE} /p4/common/bin/rotate_journal.sh ${INSTANCE}
# 5 6 * * 6 [ $(date +\%d) -le 07 ] && /p4/common/bin/run_if_master.sh ${INSTANCE} /p4/common/bin/recreate_db_checkpoint.sh ${INSTANCE}

# If you enable to recreate_db_checkpoint.sh, be sure to change 0-6 to 0-5 below.
5 4 * * 0-6 [ -e /p4/common/bin ] && /p4/common/bin/run_if_master.sh ${INSTANCE} /p4/common/bin/rotate_journal.sh ${INSTANCE}
5 5 * * 0-6 [ -e /p4/common/bin ] && /p4/common/bin/run_if_master.sh ${INSTANCE} /p4/common/bin/daily_checkpoint.sh ${INSTANCE}

# 35 6 * * 6 [ $(date +\%d) -le 07 ] && /p4/common/bin/run_if_edge.sh ${INSTANCE} /p4/common/bin/recreate_db_checkpoint.sh ${INSTANCE}

# If you enable to recreate_db_checkpoint.sh, be sure to change 0-6 to 0-5 below.
35 6 * * 0-6 [ -e /p4/common/bin ] && /p4/common/bin/run_if_edge.sh ${INSTANCE} /p4/common/bin/daily_checkpoint.sh ${INSTANCE}

# p4review daemon - This function is handled by Swarm now.
# */5 * * * * [ -e /p4/common/bin ] && /p4/common/bin/run_if_master.sh ${INSTANCE} /p4/common/bin/p4review.py ${INSTANCE}

# Kill IDLE and Init tasks that sit more than 5 minutes. Use on servers where you are having problems with IDLE connections sitting too long.
# */10 * * * * [ -e /p4/common/bin ] && /p4/common/bin/p4master_run ${INSTANCE} /p4/common/bin/kill_idle.sh ${INSTANCE}

# Replica Tasks

# Verify
# Run the replica verify quarterly.
# Use the -P parameter to run a parallel verify on the replica servers.
5 21 * * 6 /p4/common/bin/run_if_replica.sh ${INSTANCE} /p4/common/bin/p4verify.sh ${INSTANCE} -P 8
# */10 * * * * /p4/common/bin/run_if_replica.sh ${INSTANCE} /p4/common/bin/verify_shelves.sh ${INSTANCE} 50

# Sync checkpoints from master
0 21 * * 1,3,5 [ -e /p4/common/bin ] && /p4/common/bin/run_if_replica.sh ${INSTANCE} /p4/common/bin/sync_replica.sh ${INSTANCE}
# Run recreate_db_checkpoint.sh on the first Saturday afternoon in Jan. and July.
5 22 * * 6 [ $(date +\%d) -le 07 ] && /p4/common/bin/run_if_replica.sh ${INSTANCE} /p4/common/bin/recreate_db_sync_replica.sh ${INSTANCE}

# If you can't run the scripts above due to rsync issues, then run this one instead.
# 0 5 * * 0-5 [ -e /p4/common/bin ] && /p4/common/bin/run_if_replica.sh ${INSTANCE} /p4/common/bin/replica_cleanup.sh ${INSTANCE}

# Replica Status
*/6 * * * * [ -e /p4/common/bin ] && /p4/common/bin/run_if_replica.sh ${INSTANCE} /p4/common/bin/replica_status.sh ${INSTANCE} > /dev/null
*/6 * * * * [ -e /p4/common/bin ] && /p4/common/bin/run_if_edge.sh ${INSTANCE} /p4/common/bin/replica_status.sh ${INSTANCE} > /dev/null

# Cache Purge on Edge servers that use lbr.replication=cache
# Comment out this line if you are not running with that config.
*/60 * * * * /p4/common/bin/run_if_edge.sh ${INSTANCE} /p4/common/bin/cacheclean.sh ${INSTANCE}

# Clean structured logs that aren't rotating
0 1 * * * [ -e /p4/common/bin ] && /p4/common/bin/run_if_replica.sh ${INSTANCE} rm -f /p4/${INSTANCE}/logs/*.csv > /dev/null
# Change User Description Committed
#26 29364 Russell C. Jackson (Rusty) Updated to be a normal crontab now that I am managing cron via Ansible.
#25 29327 Russell C. Jackson (Rusty) Increased journal rotations
#24 29145 Russell C. Jackson (Rusty) Updates to make sync replica run on alternate days to handle large checkpoints better.
#23 29139 Russell C. Jackson (Rusty) Added check for 2GB of free space in offline db before allowing scripts to proceed.
#22 29056 Russell C. Jackson (Rusty) Forgot to comment new line.
#21 29053 Russell C. Jackson (Rusty) Changed crontab to UTC and fixed recreate_db_checkpoint.sh to replay journals to offline db before stopping the service to reduce the downtime.
#20 28972 Russell C. Jackson (Rusty) Commented out kill_idle.
#19 28952 Russell C. Jackson (Rusty) Corrected wweekly typo.
#18 28939 Russell C. Jackson (Rusty) Modified unlock to only run every six hours.
#17 28937 Russell C. Jackson (Rusty) Commented things out to work better with Ansible installs.
#16 28933 Russell C. Jackson (Rusty) Modified crontab to better suit current environment.
#15 28869 Russell C. Jackson (Rusty) Added kill_idle.sh to crontab and modified kill_idle.sh to use p4 monitor terminate and removed 1 hour ignore.
#14 28171 Russell C. Jackson (Rusty) Crontab updates.
#13 28016 Russell C. Jackson (Rusty) Added verify_shelves.sh to crontab since Perforce doesn't always replicate them to standby servers.
#12 28005 Russell C. Jackson (Rusty) Fixed missing OFFLINECHECKPOINTNUM issue and fixed entries in template.p4.crontab.
#11 26942 Russell C. Jackson (Rusty) Changed crontab to run cacheclean hourly with the new free space check.
#10 24675 Russell C. Jackson (Rusty) Fixed bugs in sdputils.py and scripts using it.
Converted to standard 2 space spacing, removed copyright stuff.
#9 24138 Russell C. Jackson (Rusty) Added the line to run the p4cachepurge.
Commented though so it has to be turned on to run.
#8 24080 Russell C. Jackson (Rusty) Redirect unlock to dev null and autoload the crontab.
#7 24077 Russell C. Jackson (Rusty) Added cron jobs to run p4 unlock -x
#6 24075 Russell C. Jackson (Rusty) Added maintenance and edge_maintenance to crontab, created edge_maintenance and updated maintenance.
#5 22836 Russell C. Jackson (Rusty) Added the -P flag to the verify on replica servers to run in parallel.
#4 22812 Russell C. Jackson (Rusty) Added missing #.
#3 22805 Russell C. Jackson (Rusty) Commented out master verify as the default, and changed replica verify to run quarterly.
#2 22803 Russell C. Jackson (Rusty) Added replica status for the edge server.
#1 22693 Russell C. Jackson (Rusty) Branched a Unix only version of the SDP.
Removed extra items to create a cleaner tree.
Moved a few items around to make more sense without Windows in the mix.