Found this on the wiki:

http://wiki.qmailtoaster.com/index.php/Maintain_Trash_and_Spam_folder
maybe I should add my adjustments to the wiki?


Modified the qtp-clean-trash to add a clean up of old emails.
As recently our backups have been taking over 14 hours, and are around 30 Gb.

So I modified the script to delete any email in the users " CUR " folder, older than 31 days .

If doing this, make sure you send a server wide email, to alert all users what you are doing.
I gave then 2 weeks notice, and ran it last night.

Worked like a charm.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#!/bin/bash

# 09/11/09 - Eric <e...@shubes.net>
# changed -ctime to -mtime
# refactored to simplify a bit
#
# 07/06/07 - Jake <j...@v2gnu.com>
# This is a modified version of Erik Espinoza's <espin...@forcenetworks.com>
# #
# 23/10/2007 - Davide <bu...@synhack.it>
# Added the possibility to use an external file to configure the deltrash value
# just put in DELTIME_FILE the path of the file which contain the value

# 12/12/11
# Modified again by Dave MacDonald <d...@techyguru.com>
# It has been modified to be used as an email cleaner.
# It will delete files in the users CUR  folder that are older than 31
# days, and can be modified by adjusting the DELTIME variable.

# default DELTIME value
DELTIME=31

# config file for deltrash
DELTIME_FILE="/var/qmail/control/deltrash"

# see if there is a configuration file for DELTIME
if [ -e "$DELTIME_FILE" ] ; then
  DELTIME_TMP=`cat $DELTIME_FILE`
  if [ "$(echo $DELTIME_TMP | grep "^[[:digit:]]*$")" ] ; then
    DELTIME=$DELTIME_TMP
  fi
fi

# find and process each Domain user accounts
# then find and process each file in the CUR directory

for directory in $(find /home/vpopmail/domains -type d -name cur); do
  for file in $(find $directory -type f -mtime +$DELTIME); do
    rm -f ${file} >/dev/null 2>&1
  done
done

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




---------------------------------------------------------------------------------
Qmailtoaster is sponsored by Vickers Consulting Group 
(www.vickersconsulting.com)
   Vickers Consulting Group offers Qmailtoaster support and installations.
     If you need professional help with your setup, contact them today!
---------------------------------------------------------------------------------
    Please visit qmailtoaster.com for the latest news, updates, and packages.
To unsubscribe, e-mail: qmailtoaster-list-unsubscr...@qmailtoaster.com
    For additional commands, e-mail: qmailtoaster-list-h...@qmailtoaster.com


Reply via email to