proxyclean.sh #1

  • //
  • guest/
  • russell_jackson/
  • sdp/
  • Server/
  • Unix/
  • p4/
  • common/
  • bin/
  • proxyclean.sh
  • View
  • Commits
  • Open Download .zip Download (744 B)
#!/bin/bash
# This script will remove all by the latest file in your /p4/1/depots/ tree.
# It is designed to work with servers running with lbr.autocompress=1 set in the configurables.
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

if [[ -f /p4/${SDP_INSTANCE}/bin/skip_cache_clean.txt ]]; then
  exit 0
fi


IFS=$'\n' depots=($(ls "/p4/${SDP_INSTANCE}/cache/"))
for depot in "${depots[@]}"
do
  if [[ !($depot =~ pdb.monitor) ]]; then
    find /p4/${SDP_INSTANCE}/cache/$depot/ -atime +10 -type f -exec rm {} \; & 
  fi
done
# Change User Description Committed
#1 26373 Russell C. Jackson (Rusty) Added a proxy clean script and a proxy crontab.