template.crontab.combined #13

  • //
  • guest/
  • perforce_software/
  • sdp/
  • dev/
  • Server/
  • Unix/
  • p4/
  • common/
  • etc/
  • cron.d/
  • template.crontab.combined
  • View
  • Commits
  • Open Download .zip Download (2 KB)
PATH=/p4/common/bin:/p4/REPL_INSTANCE/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:
SHELL=/bin/bash

INSTANCE=REPL_INSTANCE
# Metadata Checkpoints
5 2 * * * [ -e /p4/common/bin ] && /p4/common/bin/run_if_master.sh ${INSTANCE} /p4/common/bin/daily_checkpoint.sh ${INSTANCE}

# Verify Archive Files
# This can optionally be removed if verifies are to be run on a replica.
5 4 * * 6 [ -e /p4/common/bin ] && /p4/common/bin/run_if_master.sh ${INSTANCE} /p4/common/bin/p4verify.sh ${INSTANCE}

# Run p4 unlock -x on edge servers each hour to remove exclusive locks that
# shouldn't be there.
0 * * * * [ -e /p4/common/bin ] && /p4/common/bin/run_if_master.sh ${INSTANCE} p4 unlock -x > /dev/null 2>&1
0 * * * * [ -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.
## 0 * * * * [ -e /p4/common/bin ] && /p4/common/bin/run_if_master.sh ${INSTANCE} /p4/common/bin/update_limits.py ${INSTANCE}

35 2 * * * [ -e /p4/common/bin ] && /p4/common/bin/run_if_edge.sh ${INSTANCE} /p4/common/bin/daily_checkpoint.sh ${INSTANCE}

# P4review Daemon
# If using Helix Swarm, enable the 'honor_p4_reviews' feature and delete this
# script.
### */5 * * * * [ -e /p4/common/bin ] && /p4/common/bin/run_if_master.sh ${INSTANCE} /p4/common/bin/p4review.py ${INSTANCE}

# Replica Tasks

# Verify Archive Files
35 4 * * 6 [ -e /p4/common/bin ] && /p4/common/bin/run_if_replica.sh ${INSTANCE} /p4/common/bin/p4verify.sh ${INSTANCE}

# Sync checkpoints from master
0 8 * * * [ -e /p4/common/bin ] && /p4/common/bin/run_if_replica.sh ${INSTANCE} /p4/common/bin/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
0 8 * * * [ -e /p4/common/bin ] && /p4/common/bin/run_if_replica.sh ${INSTANCE} /p4/common/bin/replica_status.sh ${INSTANCE} > /dev/null
0 8 * * * [ -e /p4/common/bin ] && /p4/common/bin/run_if_edge.sh ${INSTANCE} /p4/common/bin/replica_status.sh ${INSTANCE} > /dev/null

# Change User Description Committed
#13 31807 C. Thomas Tyler Corrected 'p4 unlock' command in crontab templates.

If 'p4 unlock' is used with both '-f' and '-x', a usage error results.
Use it only with '-x' (as per the original implementation).
#12 31524 C. Thomas Tyler Removed 'MAILTO' and 'MAILFROM' settings from crontab templates.

These cause the crontab to fail to load on Ubuntu systems, resulting
in this (rather confusing) error:

"/tmp/cf3":0: bad minute
errors in crontab file, can't install.

The individual SDP scripts set MAILTO and MAILFROM in the scripts,
so having these set wasn't necessary in any case.
#11 31304 C. Thomas Tyler Corrected '*/60 * * * *' entries in crontab to be "0 * * * *'.
 This has the same
meaning (run every hour), but uses valid syntax that works across Linux distros.
The */60 syntax, while technically invalid, is interpreted as intended on RHEL/Rocky
and Ubuntu distros, but is rejected as invalid on SuSE Linux (where it is righteously
rejected).  Replacing '*/60' with '0' has the same symantic mealing but uses a
syntax valid across platforms.
#10 30907 C. Thomas Tyler Changed 'p4 unlock -x' to 'p4 unlock -f -x'.
#9 27005 Robert Cowham Fix syntax error in p4verify line.
#8 26681 Robert Cowham Removing Deprecated folder - if people want it they can look at past history!
All functions have been replaced with standard functionality such as built in LDAP,
or default change type.
Documentation added for the contents of Unsupported folder.
Changes to scripts/triggers are usually to insert tags for inclusion in ASCII Doctor docs.
#7 26238 C. Thomas Tyler Crontab cleanup:
* Removed bogus refs to deleted scripts.
* Commented out optional maintenance script, and updated comment
to indicate when to use them.
* Cleaned up and corrected comments.
* Changed crontab schedule to optimize for most common use case,
e.g. running checkpoints weekly rather than monthly (typically done
only at extreme scale).
#6 26060 C. Thomas Tyler This supercedes review-24715.

Bringing over recent bug fixes and code clean up from Rusty Jackson's local branch.

Adds an edge maintenance script to unload clients on edge servers.

Automated setting up maintenance.cfg from mkdirs.cfg settings.

Cleaned up sdputils.py - It had a logic bug, and fixed all scripts based on changes.

== Merge Details ==

Merge strategy: All the fixes to Maintenance scripts were brought in, but not the changes to active them in crontab that would enable them.

Rusty's original change had crontab changes to call maintenance scripts, and also calls to 'p4 unlock -x' as a workround to p4d bugs related to orphanged locks on edge servers. Those bugs are already fixed.  Also, adding anything new to cron requires a test suite addition and doc updates.  So changes to the template.crontab.combined were ignored. However, a new file was added to the Maintenace folder, sample_cron_entries.txt, to make it easy for folks to see those changes.

Rusty's original change had mkdirs.sh changes to generate maintenance.cfg. This change was enhanced during the merge. Rather than overwriting maintenance.cfg (potentially blowing away configuration for other instances), a new section for the new instance is appended to maintenance.cfg when 'mkdirs.sh <instance>' is run.

Future considerations: Before adding anything from Maintenance to cron, we  need to do the following:
* Have mkdirs.sh install the Maintenance folder to the as-deployed structure under /p4/common, i.e. to /p4/common/maintenance, for HMS management compliance.
* Add tests and docs for each script called (directly or indirectly).
#5 25480 C. Thomas Tyler Removed crontab refs to obsolete scripts.

Self-approving this for patch.
#4 24407 C. Thomas Tyler Recovering recreate_db_checkpoint.sh and undoing other changes done in
change @24393 as a quick patch/fix for SDP-341.

Also uncommenting the test for this script as the script is being
re-added.

Bypassing pre-commit review for this, as I need to commit this before
making the next set of more review-worthy changes, including renaming
this script per discussion in review:
https://swarm.workshop.perforce.com/reviews/24394/#comments
#3 24393 C. Thomas Tyler Removed recreate_db_checkpoint.sh, and references to it in
crontab and documentation.  It may be restored in a future
release.

See job SDP-341 for details and alternatives to deleting this script.

#review-24394 @robert_cowham @josh
#2 22804 Russell C. Jackson (Rusty) Added replica status for the edge server and changed replica verifies to run monthly.
#1 22688 Russell C. Jackson (Rusty) Combined template for upcoming change with review.