Commit bce2bfd7 authored by Nick Bearson's avatar Nick Bearson
Browse files

added auto-purge of incoming, quarantine, and processing for files older than 64 days

parent 8b846ea7
# mondays @ 02:01 # mondays @ 02:01, rotate the logs
1 2 * * 1 logrotate -f /home/eodn/eodn2realearth/conf/logrotate.conf -s /home/eodn/eodn2realearth/logs/rotate.status 1 2 * * 1 logrotate -f /home/eodn/eodn2realearth/conf/logrotate.conf -s /home/eodn/eodn2realearth/logs/rotate.status
# mondays @ 01:01, purge old files
1 1 * * 1 /home/eodn/eodn2realearth/src/purge.sh
#!/usr/bin/env bash
set -u
set -e
DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
. "$DIR/consts.sh"
LOG=${LOGS}/purge.log
exec >> $LOG 2>&1
DAYS_TO_KEEP=64 # landsat repeats every 16 days, keep 4 cycles? seems like we have the disk space
purge() {
find $1 -mtime ${DAYS_TO_KEEP} -type f -exec echo "PURGING: {}" \; -exec rm {} \;
find $1 -mtime ${DAYS_TO_KEEP} -type d -exec echo "PURGING: {}" \; -exec rm -r {} \;
}
purge $INCOMING
purge $PROCESSING
purge $QUARANTINE
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment