#!/bin/sh # Cleans up the old stuff in your local OSBF-Lua directory. # Should be run as cron job once a month or so. E.g., add this entry to # your crontab to run in the morning of the 15th of each month: # 0 3 15 * * /spamfilter-cleanup.sh # # Created by Christian Siefkes . # v1.0 - 2007-01-05 - Original Version # v1.0.1 - 2007-01-09 - Introduced config variables, proposed by Fidelis Assis # v1.0.2 - 2007-11-16 - Made slightly more robust # # Feel free to use/modify this program any way you like. # Use at your own risk. # Config variables, adapt as necessary CACHE_DIR=$HOME/.osbf-lua/cache LOG_DIR=$HOME/.osbf-lua/log RETENTION=30 FIND=/usr/bin/find BZIP=/usr/bin/bzip2 RM=/bin/rm MV=/bin/mv # Delete all cached mails that are older than a month ($RETENTION days): $FIND $CACHE_DIR -mtime +$RETENTION -name "sfid*" -exec $RM -f "{}" \; && # Archive (bzip) log files of last month, remove old archives: cd $LOG_DIR && for file in *.log *inbox; do $MV $file $file.last-month; done $RM -f *.last-month.bz2 $BZIP *.last-month